yashsingh1/xdaforums huggingface dataset:
[XPERIA X8 Android Development] AnDyX:
I started making swap module but I feel that making Netfilter module is much easier to accomplish.

Now swap module waits for moment where Netfilter module will be ready.

If someone test WifiTether with this module already - let us know (with logs of course).

I will add some scripts to copy and insmod this module using adb to use it easier.
[XPERIA X8 Android Development] Ravencz:
Awesome work! Will test later with MiniPro and will give you feedback :)
[XPERIA X8 Android Development] teapea:
All installed OK on x10 MP

However I can't get any of the usual Proxy programs to work with it

This command from TransProxy for example fails

iptables -t nat -A OUTPUT -p tcp --dport 80 -j REDIRECT --to 8123
[XPERIA X8 Android Development] sukartochen:
How to instal its?. .give me a simple way please...thank you .
[XPERIA X8 Android Development] biscoitu:
@D4rK, did you type "iptables -L result" or just "iptables -L"?
[XPERIA X8 Android Development] D4rKn3sSyS:
"iptables -L result" would have been returned "bla. not found"
[XPERIA X8 Android Development] biscoitu:
I didn´t tried the module :P, I just saw that in your post and guessed that you´ve typed that result on your command line :D

I´ll test the module on X8 to see if it returns the same :)

Edit: on X8 those commands didn´t give me any errors
[XPERIA X8 Android Development] AnDyX:
its my fault :(

I will correct 1 post, it should be one of those commands:

iptables -L
iptables -t nat -L
[XPERIA X8 Android Development] D4rKn3sSyS:
Yes, that were the commands that I ran. For now seems like works (getting packages), I'll try a native tethering app, but that error, what means ?

error is: No chain/target/match by that name
Allocating handle
within TC_INIT for table nat
Continuing..Returning OKerror is: Table does not exist (do you need to insmod?)
Ok with table: nat
[XPERIA X8 Android Development] AnDyX:
looks like 'iptable_nat' module does works .....

it should add 'nat' table to netfilter.

------------------------------------------

Edit:

Ok with table: nat
Chain PREROUTING (policy ACCEPT)
target prot opt source destination

Chain POSTROUTING (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

sorry this is 'nat' table, so I must look into iptables code to find what cause the problem.

I didn't try anything with iptables and proxy - so far netfilter is POC now. After next version I will start to make tethering work.
[XPERIA X8 Android Development] ruifung:
Device: x10 Mini Pro

I have attached log files.
[XPERIA X8 Android Development] AnDyX:
I just finished first version of Netfilter modules. I tried to use WifiTether - but with the same results as above. I just think that 'tether_edify' must be changed to use with our devices. This is priority now.

I don't have much time - but I will try to clean mess in 1st post and add some useful info.
[XPERIA X8 Android Development] SpyderX:
Omg! AnDyX, you are truly awesome! Nice work and thanks :D.
[XPERIA X8 Android Development] Koulis2000:
I don't know if this is caused by the module: I downloaded Wireless Tether for root users app and when started the service, my laptop found an Android Tether network and I connected to it, I don't know if it can shares my mobiles data plan because my data plan was expired and so I didn't tested.
[XPERIA X8 Android Development] :
So wifi thether will work now onwards? Yaayyy
[XPERIA X8 Android Development] AnDyX:
Original WifiTether does not work.

I changed scripts from WifiTether to work with our X8a and I must recompile WifiTether and check if it works.
[XPERIA X8 Android Development] Koulis2000:
What do you mean original? Is there any option in settings to enable it instead of an app? I think that in Gingerbreads there is an option to enable it but in Froyos I'm afraid that there isn't. Correct me if I'm wrong.
[XPERIA X8 Android Development] ponanovn:
It is supposed to be in Froyo and GB but it is disabled in some roms becouse it did not work before.
[XPERIA X8 Android Development] AnDyX:
I'm trying to make work Wifi Tether application to work: Wifi Tether.

I don't how it work in Gingerbread and I don't know how to enable it yet.
[XPERIA X8 Android Development] SpyderX:
Iptables works using wireless tether from the market apart from a NAT error. However, after turning off tethering, wifi cannot start and says that there is an error and afterwards tethering doesn't work. Strangely, when wifi has an error, it can start the NAT. Not bad, at least netfilter is loaded.
[XPERIA X8 Android Development] Koulis2000:
This is the app that I mentioned above, it worked. I connected my PC to my phone and after a few minutes my PC disconnected.

EDIT: Now it is gettings some errors.

-Loading WiFi driver failed

-Activating WiFi interface failed

and so on
[XPERIA X8 Android Development] AnDyX:
Yes, because script removes one required driver and couldn't load it again.

Wifi is disconnected after a while because we need to add the same fix as 'legend' phone, so as I said - I provide WifiTether builded by me and with changed scripts.
[XPERIA X8 Android Development] ponanovn:
GB built in USB tethering starts but my PC does not detect anything when it is started.
[XPERIA X8 Android Development] mukptl:
GB have built in WiFi tethering too but its disable while porting rom for x8 x10 mini & mini pro

maybe rom dev help to make on in built WiFi tether
[XPERIA X8 Android Development] Asycid:
Erm... sorry, but I'm not sure I understand this. Barnacle WiFi tether works for me without any module or magic. I mean I just start it, it gets SU, and then my laptop can connect to it, and if the HSDPA/EDGE connection is on, then I've got Net on my notie. So, I don't understand why someone says WiFi tether is not working. :S
[XPERIA X8 Android Development] ruifung:
Barnacle WiFi Tether uses ad-hoc networking, the wifi tether we're talking about uses Infastructure mode (makes the phone act like a router)

EDIT: Wheres that wifitether provided by you?

EDIT2: Error is: protocool not supported..?

X10 mini pro
[XPERIA X8 Android Development] Koulis2000:
You can find that WiFi Tether app via the link that AnDyX posted above or via android market with the name WiFi Tether for Root Users.
[XPERIA X8 Android Development] ruifung:
I meant this.-----------/\---------------------------

------------------------/--\--------------------------

-----------------------/----\-------------------------

----------------------/--||--\------------------------

-------------------------||---------------------------

-------------------------||---------------------------

-------------------------||---------------------------
[XPERIA X8 Android Development] Koulis2000:
Sorry, I hadn't read that.
[XPERIA X8 Android Development] AnDyX:
This is the latest version that I build. Just remember to remove old version before install this one.
[XPERIA X8 Android Development] Imppy:
Do i need to install the modules on top of this to get wifi tefhering
[XPERIA X8 Android Development] ponanovn:
You need to install the modules before you can use the app.

@AnDyX: the PC install script is supposed to install the modules copies netfilter folder to a file named netfilter in system/lib/modules.
[XPERIA X8 Android Development] Imppy:
thank you for your response, is this more stable than bernacle wifi tether, what is the advantage of using built in tether compared to berncle wifi?
[XPERIA X8 Android Development] ponanovn:
Correct me if I am wrong but I think native supports up to 5 clients at once but Barnacle only supports one.
[XPERIA X8 Android Development] ruifung:
I think barnacle supports more then 1 client (its ad-hoc everyone connects to everyone) its just not stable enough for me, my pc keeps disconnecting.

EDIT: @AnDyX: Tried it, same results as original app from market. (x10 mini pro)
[XPERIA X8 Android Development] ponanovn:
It is modified to load needed modules on start and turn off properly on the X8/X10 mini/pro (the original does not work if you turn it off and start it again).
[XPERIA X8 Android Development] ponanovn:
Sorry I clicked qwote instead of edit, I need to sleep.

@mod Please delete this post
[XPERIA X8 Android Development] SpyderX:
Now everything works, but after stop tethering wifi error again...
[XPERIA X8 Android Development] mukptl:
WiFi Tether log- Enabling NAT rules failed

loading WiFi driver

done

Activating WiFi interface

done

setting ad-hoc mode

done

setting essid

done

setting channel

done

Enabling NAT rules

failed

Enabling IP forwarding

done

Tethering now running

done

X10 Mini pro

ROM FroyoBread v023d
[XPERIA X8 Android Development] AnDyX:
I just quickly want to say that WifiTether can be run manually and shows all actions.

to start:

cd /data/data/android.tether/bin
./tether start 1

to stop it:

cd /data/data/android.tether/bin
./tether stop 1
[XPERIA X8 Android Development] D4rKn3sSyS:
So problem it's with Java? im java programmer, if you need some help, just tell me
[XPERIA X8 Android Development] deedii:
D4rk can you create again an automated installation of this like what you did in DT module? Thanks much :) In your most available time please!
[XPERIA X8 Android Development] SpyderX:
If anyone (for any reason) wants to activate netfilter on boot, after copying files to correct location, add this line to hw_config.sh

sh /system/xbin/full_iptables.sh

Remember to make backups as editing hw_config.sh is risky business! :D
[XPERIA X8 Android Development] D4rKn3sSyS:
Yeah, I can surelly do it when i got some time, Maybe it's better to join everything into an APK, that would be nice :D
[XPERIA X8 Android Development] AnDyX:
Sorry for disappearing :). I found an issue with received packets - so I fight whole weekend to find place in code to detect what it cause. After testing new modules and WifiTether at home - I will release new version and remove old ones.
[XPERIA X8 Android Development] ponanovn:
Could you please make USB-tethering work also, it is more important than wifi-tethering for me.
[XPERIA X8 Android Development] XperianPro:
And firewall support to.

Sent from X8 using XDA Premium app and running GingerDX
[XPERIA X8 Android Development] Imppy:
can anyone tether now? I'm not talking bernicle as it is kind of unstable...i'm talking about using netfilter method

thanks!
[XPERIA X8 Android Development] AnDyX:
Starting now Wifi tethering works using app from first post and netfilter modules.

I didn't check if encryption works. I will do this later.

# iptables -v -n -L -t nat
iptables -v -n -L -t nat
Chain PREROUTING (policy ACCEPT 525 packets, 33368 bytes)
pkts bytes target prot opt in out source destination

Chain POSTROUTING (policy ACCEPT 326 packets, 21930 bytes)
pkts bytes target prot opt in out source destination

72 4027 MASQUERADE 0 -- * * 192.168.2.0/24 0.0.0.0/0

Chain OUTPUT (policy ACCEPT 330 packets, 22752 bytes)
pkts bytes target prot opt in out source destination

If you talking about writing firewall by yourself using iptables - it possible now.

I found app that is frontend to iptables: DroidWall
[XPERIA X8 Android Development] ruifung:
Even in the latest version, the tether app requires a reboot before wifi will work properly again. (x10MP).
[XPERIA X8 Android Development] Koulis2000:
After copying the files, do we have to write anything to Terminal or something.

EDIT: Sorry found it.
[XPERIA X8 Android Development] Koulis2000:
All f@cking awesome.

Connected 3 out of 3 tests, and then connected on my router without having to reboot phone.

The log showed up "done!" in all.
[XPERIA X8 Android Development] biscoitu:
Well, I´ve tried to use the tethering here with the last version of module. The insmod was all Ok, but no ip address was found on notebook. I tried put it manually but doesn´t work.

My iptables output for the rules was this:

# iptables -L
iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination
DROP 0 -- anywhere anywhere state INVALID
wireless-tether 0 -- anywhere anywhere

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Chain wireless-tether (1 references)
target prot opt source destination
ACCEPT 0 -- anywhere anywhere state RELATED,ESTAB
LISHED
FIX ME! implement getnetbyaddr() bionic/libc/bionic/stubs.c:372
ACCEPT 0 -- 192.168.2.0/24 anywhere
FIX ME! implement getprotobynumber() bionic/libc/bionic/stubs.c:384
ACCEPT 47 -- anywhere anywhere
DROP 0 -- anywhere anywhere
# iptables -t nat -L
iptables -t nat -L
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
FIX ME! implement getnetbyaddr() bionic/libc/bionic/stubs.c:372
DROP 0 -- 192.168.2.0/24 anywhere

Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
FIX ME! implement getnetbyaddr() bionic/libc/bionic/stubs.c:372
MASQUERADE 0 -- 192.168.2.0/24 anywhere

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
#

What could be wrong????

Thanks in advance :)
[XPERIA X8 Android Development] AnDyX:
do you removed old app before install new on ?

if yes - do the following and copy results:

cd /data/data/android.tether/conf
cat tether.conf

check if wifi works ok. do the following:

cd /data/data/android.tether/bin
./iwconfig wlan0
ip address
ip route
./ipconfig wlan0

and show the results
[XPERIA X8 Android Development] Imppy:
where do we type this in? I installed through adb but no success with the app in tethering...it seems that my computer is connected to the wireless tether network but I get no connection....what am i doing wrong?
[XPERIA X8 Android Development] biscoitu:
Here it goes:

# ./iwconfig wlan0
./iwconfig wlan0
wlan0 IEEE 802.11ABG ESSID:"b1sc8"
Mode:Ad-Hoc Frequency:1 kHz Cell: 02:00:00:C5:78:8E
Tx-Power:-51 Sensitivity=-80 dBm
RTS thr=4096 B Fragment thr=4096 B
Encryption key:off
Link Quality=0/0 Signal level=0 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

# ip address
ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
[1] Segmentation fault ip address
# ip route
ip route
186.254.2.193 dev rmnet0
186.254.2.192/27 dev rmnet0 src 186.254.2.207
192.168.2.0/24 dev wlan0 src 192.168.2.254
default via 186.254.2.193 dev rmnet0
# ./ipconfig wlan0
./ipconfig wlan0
./ipconfig: not found
# ./ifconfig wlan0
./ifconfig wlan0
wlan0: ip 192.168.2.254 mask 255.255.255.0 flags [up broadcast running multicast
]
#

I started tethering by the "./tether start 1" command. It gaves no errors at all, but I can´t make it work :(
[XPERIA X8 Android Development] AnDyX:
so could you please show the result of

./tether start 1
./tether stop 1

command

for unknown for me reason - AdHoc always is set to channel 1. Check if this channel is not busy already - you can use Wifi Analyzer.

For comparing and for analyze I will provide results of commands from my phone.
[XPERIA X8 Android Development] biscoitu:
Well AnDyX sry for the big posts, but I think it´s better than attach zips :D

Here it goes (I saw an error in start that I didn´t see before):

Start Command:

# ./tether start 1
./tether start 1
about to run: [/system/bin/tiwlan_loader -i /etc/wifi/tiwlan.ini -f /etc/wifi/ti
wlan_firmware.bin -e /data/etc/wifi/fw]
Set property wlan.driver.status = ok - Ok
about to run: [/data/data/android.tether/bin/ifconfig wlan0 192.168.2.254 netmas
k 255.255.255.0]
about to run: [/data/data/android.tether/bin/ifconfig wlan0 up]
about to run: [/data/data/android.tether/bin/iwconfig wlan0 mode ad-hoc]
about to run: [/data/data/android.tether/bin/iwconfig wlan0 essid b1sc8]
about to run: [/data/data/android.tether/bin/iwconfig wlan0 channel 1]
about to run: [/data/data/android.tether/bin/iwconfig wlan0 commit]
Error for wireless request "Commit changes" (8B00) :
SET failed on device wlan0 ; Operation not supported on transport endpoint.
about to run: [/data/data/android.tether/bin/fixpersist.sh wlan0 b1sc8 1 & echo
$! > /data/data/android.tether/var/fixpersist.pid]
about to run: [/data/data/android.tether/bin/iptables -N wireless-tether]
about to run: [/data/data/android.tether/bin/iptables -F wireless-tether]
about to run: [/data/data/android.tether/bin/iptables -t nat -F PREROUTING]
about to run: [/data/data/android.tether/bin/iptables -t nat -F POSTROUTING]
about to run: [/data/data/android.tether/bin/iptables -t nat -F]
about to run: [/data/data/android.tether/bin/iptables -A wireless-tether -m stat
e --state ESTABLISHED,RELATED -j ACCEPT]
about to run: [/data/data/android.tether/bin/iptables -A wireless-tether -s 192.
168.2.0/24 -j ACCEPT]
about to run: [/data/data/android.tether/bin/iptables -A wireless-tether -p 47 -
j ACCEPT]
about to run: [/data/data/android.tether/bin/iptables -A wireless-tether -j DROP
]
about to run: [/data/data/android.tether/bin/iptables -A FORWARD -m state --stat
e INVALID -j DROP]
about to run: [/data/data/android.tether/bin/iptables -A FORWARD -j wireless-tet
her]
about to run: [/data/data/android.tether/bin/iptables -t nat -I POSTROUTING -s 1
92.168.2.0/24 -j MASQUERADE]
about to run: [/data/data/android.tether/bin/dnsmasq -i wlan0 --resolv-file=/dat
a/data/android.tether/conf/resolv.conf --conf-file=/data/data/android.tether/con
f/dnsmasq.conf]
about to run: [/data/data/android.tether/bin/iptables -t nat -I PREROUTING -s 19
2.168.2.0/24 -j DROP]
script result was []

Stop command:

# ./tether stop 1
./tether stop 1
about to run: [/data/data/android.tether/bin/iptables -D FORWARD -j wireless-tet
her]
about to run: [/data/data/android.tether/bin/iptables -D FORWARD -m state --stat
e INVALID -j DROP]
about to run: [/data/data/android.tether/bin/iptables -F wireless-tether]
about to run: [/data/data/android.tether/bin/iptables -X wireless-tether]
about to run: [/data/data/android.tether/bin/iptables -t nat -F PREROUTING]
about to run: [/data/data/android.tether/bin/iptables -t nat -F POSTROUTING]
about to run: [/data/data/android.tether/bin/iptables -t nat -F]
about to run: [/data/data/android.tether/bin/ifconfig wlan0 down]
script result was []
#
[XPERIA X8 Android Development] Koulis2000:
Sorry if it's a little noobish question:

Can other devices(like Android phones) connect to the "created" network?
[XPERIA X8 Android Development] LuisDias:
yap, of course.. xD
[XPERIA X8 Android Development] lopman:
i keep getting this message after i try to load module

C:\adb>adb shell

# su

su

# sh /system/xbin/full_iptables.sh

sh /system/xbin/full_iptables.sh

cd: can't cd to /system/lib/modules/netfilter

insmod: can't open 'ax8netfilter.ko'

insmod: can't open 'x_tables.ko'

insmod: can't open 'ip_tables.ko'

insmod: can't open 'iptable_filter.ko'

insmod: can't open 'nf_conntrack.ko'

insmod: can't open 'xt_multiport.ko'

insmod: can't open 'nf_defrag_ipv4.ko'

insmod: can't open 'nf_conntrack_ipv4.ko'

insmod: can't open 'nf_nat.ko'

insmod: can't open 'iptable_nat.ko'

insmod: can't open 'ipt_MASQUERADE.ko'

ls: xt_*: No such file or directory

ls: nf*: No such file or directory

ls: ipt_*: No such file or directory

#

can anyone help please:)
[XPERIA X8 Android Development] DeFcOn:
+1 i have same))
[XPERIA X8 Android Development] ponanovn:
Did you install it with the windowś script, it copies the files to a file named netfilter instead of a foalder.
[XPERIA X8 Android Development] biscoitu:
It won´t make it if you create the folder before running the script :D
[XPERIA X8 Android Development] AnDyX:
crap - I forgot about this ...
[XPERIA X8 Android Development] lopman:
i used the script and now i got this

# sh /system/xbin/full_iptables.sh

sh /system/xbin/full_iptables.sh

cd: can't cd to /system/lib/modules/netfilter

insmod: can't open 'ax8netfilter.ko'

insmod: can't open 'x_tables.ko'

insmod: can't open 'ip_tables.ko'

insmod: can't open 'iptable_filter.ko'

insmod: can't open 'nf_conntrack.ko'

insmod: can't open 'xt_multiport.ko'

insmod: can't open 'nf_defrag_ipv4.ko'

insmod: can't open 'nf_conntrack_ipv4.ko'

insmod: can't open 'nf_nat.ko'

insmod: can't open 'iptable_nat.ko'

insmod: can't open 'ipt_MASQUERADE.ko'

ls: xt_*: No such file or directory

ls: nf*: No such file or directory

ls: ipt_*: No such file or directory

#
[XPERIA X8 Android Development] kakho55:
SamE Here.. i using froyobreD... andy , u using xgin??
[XPERIA X8 Android Development] biscoitu:
Don´t worry bro, you are human :D, You did a lot already, I didn´t get it working properly, but I will try on weekend with time :). I´ve got all that steps, but it will give my notebook an IP address or I must set it by hand? that´s my doubt, since I get ip on wlan0 but I even can´t ping it from notebook or the inverse :p
[XPERIA X8 Android Development] ruifung:
If you use the wifi-tether app provided, it has DHCP support. Anyway, about every tethering app has DHCP.
[XPERIA X8 Android Development] AnDyX:
I upload script again for coping netfilter modules on phone.

If this happened to you:

C:\adb>adb shell
# su
su
# sh /system/xbin/full_iptables.sh
sh /system/xbin/full_iptables.sh
cd: can't cd to /system/lib/modules/netfilter
insmod: can't open 'ax8netfilter.ko'
insmod: can't open 'x_tables.ko'
insmod: can't open 'ip_tables.ko'
insmod: can't open 'iptable_filter.ko'
insmod: can't open 'nf_conntrack.ko'
insmod: can't open 'xt_multiport.ko'
insmod: can't open 'nf_defrag_ipv4.ko'
insmod: can't open 'nf_conntrack_ipv4.ko'
insmod: can't open 'nf_nat.ko'
insmod: can't open 'iptable_nat.ko'
insmod: can't open 'ipt_MASQUERADE.ko'
ls: xt_*: No such file or directory
ls: nf*: No such file or directory
ls: ipt_*: No such file or directory
#

get new script from 1st post and upload modules again.

If your notebook has IP than you can check if there is any packet traffic using iptables, e.g:

iptables [B]-v[/B] -n -L

if not - I still think that there is something on your channel, possibility that DHCP don't work is minimal.

Immediately after releasing 3 version of netfilter I start working on swap module - so I'm a bit tired. Hopefully tomorrow I will be know I swap i possible ;)
[XPERIA X8 Android Development] nobodyAtall:
AnDyX, what are the changes you did to wifi tether to make it work.

Also, are there any conflicts when loading/unloading the wifi module?
[XPERIA X8 Android Development] doixanh:
He pushed source on github, you can see...
[XPERIA X8 Android Development] andrestander:
I installed your modules manually

moved folder and files myself then applied CHMOD through terminal

ASProxy still shows no Netfilters/IPtable support.
[XPERIA X8 Android Development] AnDyX:
did you run basic_iptables.sh or full _iptables.sh script ?

ASProxy use in following way:

so even basic_iptables.sh script should be fine.
[XPERIA X8 Android Development] lopman:
I am still getting the same problem
[XPERIA X8 Android Development] andrestander:
lolwut I didn't know you should execute a script. I just copied the files and ran CHMOD.

I have no idea how to use this script. xD

I tried

su

sh /system/xbin/full_iptables.sh

and it gave me a long list of errors. *.ko (file exists)

I 2 copies of the .ko files. 1 copy in xbin and 1 copy in /system/lib/modules/netfitler

lol wat im doing wrong?
[XPERIA X8 Android Development] SpyderX:
Did you check if there was netfilter? Because this happens for me but i still have netfilter
[XPERIA X8 Android Development] AnDyX:
Could you show the errors ?
[XPERIA X8 Android Development] AnDyX:
These errors means that 'ax8netfilter.ko' module and later ones is already loaded.
[XPERIA X8 Android Development] andrestander:
Well I'm sorry I am not too much of a geek. :(
[XPERIA X8 Android Development] AnDyX:
If you execute 'lsmod' command and results shows that modules are loaded - there is no need to load them again.