Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firewallrules will be changed when I use tethering #134

Closed
klarglas opened this issue May 8, 2013 · 10 comments
Closed

Firewallrules will be changed when I use tethering #134

klarglas opened this issue May 8, 2013 · 10 comments
Labels

Comments

@klarglas
Copy link

klarglas commented May 8, 2013

I have some problems with afwall and WLAN-tethering. If I activate tethering and also if I deactivate it, the iptable-rules will be changed. Especially the outputchain will be buypassed. Then my phone has full access to internet. And I want also to filter tethering, but in this case I have no chance to do that.

Both times, at activating and deactivation the ruleset of iptables will be changed. Is there any possibility to avoid that? For me this bug seems critical, because it bypasses the complete firewall.

I found for droidwall some issue, which look very similar.
https://github.com/peterhoeg/droidwall/issues/18
http://code.google.com/p/droidwall/issues/detail?id=123

Sorry, that I post so much information, but I hope, this will help you to find a solution.

The beginning

My iptable-ruleset:
# iptables --list
Chain INPUT (policy ACCEPT)
target prot opt source destination

    Chain FORWARD (policy DROP)
    target     prot opt source               destination

    Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination
    afwall     all  --  anywhere             anywhere

    Chain afwall (1 references)
    target     prot opt source               destination
    RETURN     udp  --  anywhere             anywhere            owner UID match root udp dpt:domain
    RETURN     tcp  --  anywhere             183.82.53.166       tcp dpt:www owner UID match app_25
    .
    .
    .

Now I activate tethering.

The iptable-list looks like this:
# iptables --list
Chain INPUT (policy ACCEPT)
target prot opt source destination

    Chain FORWARD (policy DROP)
    target     prot opt source               destination
    ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
    ACCEPT     all  --  anywhere             anywhere

    Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination
    afwall     all  --  anywhere             anywhere

    Chain afwall (1 references)
    target     prot opt source               destination
    RETURN     udp  --  anywhere             anywhere            owner UID match root udp dpt:domain
    RETURN     tcp  --  anywhere             183.82.53.166       tcp dpt:www owner UID match app_25
    .
    .
    .

Logcate gives me something like this:
--------- beginning of /dev/log/system
W/InputManagerService( 2060): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@406fc630
I/ActivityManager( 2060): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10100000 cmp=com.android.settings/.Settings bnds=[655,403][753,476] } from pid 2060
I/ActivityManager( 2060): Starting: Intent { act=android.intent.action.MAIN cmp=com.android.settings/.TetherSettings } from pid 11355
--------- beginning of /dev/log/main
D/ViewConsistency(11355): AbsListView android.widget.ListView@4055d4c0 enabled= false
D/ViewConsistency(11355): AbsListView android.widget.ListView@4055d4c0 enabled= false
I/ActivityManager( 2060): Displayed com.android.settings/.TetherSettings: +238ms
D/BluetoothNetworkService( 2060): updating tether state
D/BluetoothNetworkService( 2060): interface tiap0
D/Tethering( 2060): sendTetherStateChangedBroadcast 1, 0, 0
D/Tethering( 2060): interfaceAdded :tiap0
D/CommandListener( 1476): Setting iface cfg
D/Tethering( 2060): Tethering tiap0
D/Tethering( 2060): InitialState.processMessage what=2
D/NetworkManagmentService( 2060): rsp <213 00:00:00:00:00:00 0.0.0.0 0.0.0.0 [down broadcast multicast]>
D/NetworkManagmentService( 2060): flags <[down broadcast multicast]>
D/Tethering( 2060): sendTetherStateChangedBroadcast 0, 0, 0
D/BluetoothNetworkService( 2060): updating tether state
D/Tethering( 2060): Tethered tiap0
D/BluetoothNetworkService( 2060): updating tether state
D/Tethering( 2060): sendTetherStateChangedBroadcast 0, 1, 0
I/ActivityManager( 2060): Start proc com.cyanogenmod.cmparts for broadcast com.cyanogenmod.cmparts/.intents.LEDNotificationReceiver: pid=15574 uid=1000 gids={1015, 3002, 3001, 3003}
D/Tethering( 2060): MasterInitialState.processMessage what=1
E/dalvikvm(15574): could not disable core file generation for pid 15574: Operation not permitted
D/Tethering( 2060): Tether Mode requested by tiap0 - TetheredState - Tethered - lastError =0
D/Tethering( 2060): chooseUpstreamType(false), dunRequired =false, iface=rmnet0
D/Tethering( 2060): checking if hipri brought us this connection
D/Tethering( 2060): notifying tethered with iface =rmnet0
D/TetherController( 1476): Setting IP forward enable = 1
D/NetworkManagmentService( 2060): rsp <213 00:00:00:00:00:00 10.240.55.234 255.0.0.0 [up running]>
D/NetworkManagmentService( 2060): flags <[up running]>
D/TetherController( 1476): Starting tethering services
D/TetherController( 1476): Tethering services running
D/TetherController( 1476): setDnsForwarders(0 = '8.8.8.8')
D/TetherController( 1476): setDnsForwarders(1 = '4.2.2.2')
D/TetherController( 1476): Sending update msg to dnsmasq [update_dns:8.8.8.8:4.2.2.2]
D/Tethering( 2060): TetheredState.processMessage what=12
I/dnsmasq (15576): started, version 2.51 cachesize 150
I/dnsmasq (15576): compile time options: no-IPv6 GNU-getopt no-DBus no-I18N DHCP no-scripts no-TFTP
W/dnsmasq (15576): warning: no upstream servers configured
I/dnsmasq (15576): DHCP, IP range 192.168.43.2 -- 192.168.43.254, lease time 1h
I/dnsmasq (15576): DHCP, IP range 192.168.42.2 -- 192.168.42.254, lease time 1h
D/szipinf (15574): Initializing inflate state
I/tiap_loader(15572): Set property wlan.ap.driver.status = ok - Ok
I/ActivityThread(15574): Pub com.cyanogenmod.cmparts.provider.Settings: com.cyanogenmod.cmparts.provider.SettingsProvider
I//system/bin/iptables( 1476): ACCEPT all opt -- in rmnet0 out tiap0 0.0.0.0/0 -> 0.0.0.0/0 state RELATED,ESTABLISHED
I//system/bin/iptables( 1476): ACCEPT all opt -- in tiap0 out rmnet0 0.0.0.0/0 -> 0.0.0.0/0
I//system/bin/iptables( 1476): MASQUERADE all opt -- in * out rmnet0 0.0.0.0/0 -> 0.0.0.0/0
I/ActivityManager( 2060): Process android.process.media (pid 11750) has died.
I/dnsmasq (15576): read /etc/hosts - 22032 addresses
I/dnsmasq (15576): using nameserver 4.2.2.2#53
I/dnsmasq (15576): using nameserver 8.8.8.8#53
D/SoftapController( 1476): Softap driver start: 0
I/hostap (15712): Configuration file: /data/misc/wifi/hostapd.conf
I/hostap (15712): _hostapd_init_iface_
I/hostap (15712): ctrl_interface_group=0
I/hostap (15712): HAPDTI wilink_init: enter
I/hostap (15712): BSS count 1, BSSID mask ff:ff:ff:ff:ff:ff (0 bits)
I/hostap (15712): HAPDTI wilink_wireless_event_init: enter
I/hostap (15712): HAPDTI wilink_get_we_version: enter
I/hostap (15712): SIOCGIWRANGE: WE(compiled)=22 WE(source)=19 enc_capa=0xf
I/hostap (15712): regulatory_build_hw_capability: Country=TI indx=4
I/hostap (15712): RATE[0] rate=10 flags=0x152
I/hostap (15712): RATE[1] rate=20 flags=0x152
I/hostap (15712): RATE[2] rate=55 flags=0x152
I/hostap (15712): RATE[3] rate=110 flags=0x152
I/hostap (15712): RATE[4] rate=60 flags=0x150
I/hostap (15712): RATE[5] rate=90 flags=0x150
I/hostap (15712): RATE[6] rate=120 flags=0x150
I/hostap (15712): RATE[7] rate=180 flags=0x150
I/hostap (15712): RATE[8] rate=240 flags=0x150
I/hostap (15712): RATE[9] rate=360 flags=0x150
I/hostap (15712): RATE[10] rate=480 flags=0x150
I/hostap (15712): RATE[11] rate=540 flags=0x150
I/hostap (15712): Passive scanning not supported
I/hostap (15712): Flushing old station entries
I/hostap (15712): Deauthenticate all stations
I/hostap (15712): HAPDTI wilink_sta_deauth: enter
I/hostap (15712): HAPDTI wilink_send_mgmt_frame: sending 26 byte MGMT frame to ff:ff:ff:ff:ff:ff
I/hostap (15712): MGMT - hexdump(len=26): c0 00 00 00 ff ff ff ff ff ff a4 ed 4e fd 5d b0 a4 ed 4e fd 5d b0 00 00 02 00
I/hostap (15712): l2_packet_send - sendto: Network is down
I/hostap (15712): Mode: IEEE 802.11g Channel: 11 Frequency: 2462 MHz
I/hostap (15712): Using interface tiap0 with hwaddr a4:ed:4e:fd:5d:b0 and ssid 'AndroidAP'
I/hostap (15712): SSID - hexdump_ascii(len=9):
I/hostap (15712): PSK (ASCII passphrase) - hexdump_ascii(len=12):
I/hostap (15712): WPA: group state machine entering state GTK_INIT (VLAN-ID 0)
I/hostap (15712): GMK - hexdump(len=32): [REMOVED]
I/hostap (15712): GTK - hexdump(len=16): [REMOVED]
I/hostap (15712): WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0)
I/hostap (15712): Using existing control interface directory.
I/hostap (15712): HAPDTI wilink_commit: COMMIT
I/hostap (15712): tiap0: Setup of interface done.
I/hostap (15712): l2_packet_receive - recvfrom: Network is down
I/hostap (15712): l2_packet_receive - recvfrom: Network is down
D/SoftapController( 1476): Softap startap - Ok
I/hostap (15712): RX ctrl_iface - hexdump_ascii(len=4):
I/hostap (15712): 50 49 4e 47 PING
D/SoftapController( 1476): tiwlan0 - tiap0 - AndroidAP - wpa2-psk - (null)
I/hostap (15712): HAPDTI wilink_wireless_event_receive: enter
I/hostap (15712): HAPDTI wilink_wireless_event_rtm_newlink: enter
I/hostap (15712): HAPDTI wilink_wireless_event_receive: enter
I/hostap (15712): HAPDTI wilink_wireless_event_rtm_newlink: enter
I/hostap (15712): RX ctrl_iface - hexdump_ascii(len=8):
I/hostap (15712): 52 45 43 4f 4e 46 49 47 RECONFIG
I/hostap (15712): ***_hostapd_reconfig_iface_
I/hostap (15712): Flushing old station entries
I/hostap (15712): Deauthenticate all stations
I/hostap (15712): HAPDTI wilink_sta_deauth: enter
I/hostap (15712): HAPDTI wilink_send_mgmt_frame: sending 26 byte MGMT frame to ff:ff:ff:ff:ff:ff
I/hostap (15712): MGMT - hexdump(len=26): c0 00 00 00 ff ff ff ff ff ff a4 ed 4e fd 5d b0 a4 ed 4e fd 5d b0 00 00 02 00
I/ActivityManager( 2060): Process dev.ukanth.ufirewall (pid 7465) has died.
I/WindowManager( 2060): WIN DEATH: Window{40806ec8 dev.ukanth.ufirewall/dev.ukanth.ufirewall.MainActivity paused=false}
I/hostap (15712): _hostapd_deinit_iface_
I/hostap (15712): Control interface directory not empty - leaving it behind
I/hostap (15712): HAPDTI wilink_wireless_event_deinit: enter
I/hostap (15712): HAPDTI wilink_deinit: enter
I/hostap (15712): _hostapd_init_iface_
I/hostap (15712): ctrl_interface_group=0
I/hostap (15712): HAPDTI wilink_init: enter
I/hostap (15712): BSS count 1, BSSID mask ff:ff:ff:ff:ff:ff (0 bits)
I/hostap (15712): HAPDTI wilink_wireless_event_init: enter
I/hostap (15712): HAPDTI wilink_get_we_version: enter
I/hostap (15712): SIOCGIWRANGE: WE(compiled)=22 WE(source)=19 enc_capa=0xf
I/hostap (15712): regulatory_build_hw_capability: Country=TI indx=4
I/hostap (15712): RATE[0] rate=10 flags=0x152
I/hostap (15712): RATE[1] rate=20 flags=0x152
I/hostap (15712): RATE[2] rate=55 flags=0x152
I/hostap (15712): RATE[3] rate=110 flags=0x152
I/hostap (15712): RATE[4] rate=60 flags=0x150
I/hostap (15712): RATE[5] rate=90 flags=0x150
I/hostap (15712): RATE[6] rate=120 flags=0x150
I/hostap (15712): RATE[7] rate=180 flags=0x150
I/hostap (15712): RATE[8] rate=240 flags=0x150
I/hostap (15712): RATE[9] rate=360 flags=0x150
I/hostap (15712): RATE[10] rate=480 flags=0x150
I/hostap (15712): RATE[11] rate=540 flags=0x150
I/hostap (15712): Passive scanning not supported
I/hostap (15712): Flushing old station entries
I/hostap (15712): Deauthenticate all stations
I/hostap (15712): HAPDTI wilink_sta_deauth: enter
I/hostap (15712): HAPDTI wilink_send_mgmt_frame: sending 26 byte MGMT frame to ff:ff:ff:ff:ff:ff
I/hostap (15712): MGMT - hexdump(len=26): c0 00 00 00 ff ff ff ff ff ff a4 ed 4e fd 5d b0 a4 ed 4e fd 5d b0 00 00 02 00
I/hostap (15712): Mode: IEEE 802.11g Channel: 11 Frequency: 2462 MHz
I/hostap (15712): Using interface tiap0 with hwaddr a4:ed:4e:fd:5d:b0 and ssid 'AndroidAP'
I/hostap (15712): SSID - hexdump_ascii(len=9):
I/hostap (15712): PSK (ASCII passphrase) - hexdump_ascii(len=12):
I/hostap (15712): WPA: group state machine entering state GTK_INIT (VLAN-ID 0)
I/hostap (15712): GMK - hexdump(len=32): [REMOVED]
I/hostap (15712): GTK - hexdump(len=16): [REMOVED]
I/hostap (15712): WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0)
I/hostap (15712): Using existing control interface directory.
I/hostap (15712): HAPDTI wilink_commit: COMMIT
I/hostap (15712): tiap0: Setup of interface done.
I/hostap (15712): HAPDTI wilink_wireless_event_receive: enter
I/hostap (15712): HAPDTI wilink_wireless_event_rtm_newlink: enter
D/SoftapController( 1476): Softap set - Ok
D/dalvikvm( 6715): GC_EXPLICIT freed 492K, 53% free 2884K/6087K, external 0K/0K, paused 42ms
D/dalvikvm( 2060): GC_EXTERNAL_ALLOC freed 1307K, 43% free 5788K/10055K, external 3780K/3809K, paused 163ms
I/ActivityManager( 2060): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10100000 cmp=org.jtb.alogcat/.LogActivity } from pid 2060
D/dalvikvm(11355): GC_EXPLICIT freed 79K, 46% free 3089K/5703K, external 0K/0K, paused 902ms
I/hostap (15712): wilink_rx_mgmt: received MGMT with len 281 from c0:25:06:7c:c4:ce
I/hostap (15712): MGMT - hexdump(len=283): 00 00 80 00 00 00 ff ff ff ff ff ff c0 25 06 7c c4 ce c0 25 06 7c c4 ce 20 39 a0 09 d5 b0 22 02 00 00 64 00 31 04 00 11 46 52 49 54 5a 21 42 6f 78 20 37 33 33 30 20 53 4c 01 08 82 84 8b 96 0c 12 18 24 03 01 0b 05 04 00 01 00 00 07 06 44 45 20 01 0d 14 2a 01 00 30 14 01 00 00 0f ac 02 01 00 00 0f ac 04 01 00 00 0f ac 02 00 00 32 04 30 48 60 6c 2d 1a ee 11 1b ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3d 16 0b 07 11 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 dd 16 00 50 f2 01 01 00 00 50 f2 02 01 00 00 50 f2 02 01 00 00 50 f2 02 dd 18 00 50 f2 02 01 01 01 00 03 a4 00 00 27 a4 00 00 42 43 5e 00 62 32 2f 00 dd 09 00 03 7f 01 01 00 00 ff 7f dd 0c 00 04 0e 01 01 02 01 00 00 00 00 00 dd 27 00 50 f2 04 10 4a 00 01 10 10 44 00 01 02 10 47 00 10 77 a0 81 04 7f e0 4a 63 81 b1 c0 25 06 7c c4 10 10 3c 00 01 03
I/hostap (15712): HAPDTI wilink_rx_mgmt: processing management frame
I/hostap (15712): station is not foundc0:25:06:7c:c4:ce
.
.
.

Especially the following entries look bad to me:
I//system/bin/iptables( 1476): ACCEPT all opt -- in rmnet0 out tiap0 0.0.0.0/0 -> 0.0.0.0/0 state RELATED,ESTABLISHED
I//system/bin/iptables( 1476): ACCEPT all opt -- in tiap0 out rmnet0 0.0.0.0/0 -> 0.0.0.0/0
I//system/bin/iptables( 1476): MASQUERADE all opt -- in * out rmnet0 0.0.0.0/0 -> 0.0.0.0/0

Now I will deactivate the WLAN Tethering:

The iptable-list looks like this:
# iptables --list
Chain INPUT (policy ACCEPT)
target prot opt source destination

    Chain FORWARD (policy DROP)
    target     prot opt source               destination

    Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination

    Chain afwall (0 references)
    target     prot opt source               destination
    RETURN     udp  --  anywhere             anywhere            owner UID match root udp dpt:domain
    RETURN     tcp  --  anywhere             183.82.53.166       tcp dpt:www owner UID match app_25
    .
    .
    .

Logcate gives me something like this:
I/hostap (15712): wilink_rx_mgmt: received MGMT with len 281 from c0:25:06:7c:c4:ce
I/hostap (15712): MGMT - hexdump(len=283): 00 00 80 00 00 00 ff ff ff ff ff ff c0 25 06 7c c4 ce c0 25 06 7c c4 ce 00 42 4b c2 af b1 22 02 00 00 64 00 31 04 00 11 46 52 49 54 5a 21 42 6f 78 20 37 33 33 30 20 53 4c 01 08 82 84 8b 96 0c 12 18 24 03 01 0b 05 04 00 01 00 00 07 06 44 45 20 01 0d 14 2a 01 00 30 14 01 00 00 0f ac 02 01 00 00 0f ac 04 01 00 00 0f ac 02 00 00 32 04 30 48 60 6c 2d 1a ee 11 1b ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3d 16 0b 07 11 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 dd 16 00 50 f2 01 01 00 00 50 f2 02 01 00 00 50 f2 02 01 00 00 50 f2 02 dd 18 00 50 f2 02 01 01 01 00 03 a4 00 00 27 a4 00 00 42 43 5e 00 62 32 2f 00 dd 09 00 03 7f 01 01 00 00 ff 7f dd 0c 00 04 0e 01 01 02 01 00 00 00 00 00 dd 27 00 50 f2 04 10 4a 00 01 10 10 44 00 01 02 10 47 00 10 77 a0 81 04 7f e0 4a 63 81 b1 c0 25 06 7c c4 10 10 3c 00 01 03
I/hostap (15712): HAPDTI wilink_rx_mgmt: processing management frame
I/hostap (15712): station is not foundc0:25:06:7c:c4:ce
I/ActivityManager( 2060): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10100000 cmp=com.android.settings/.Settings bnds=[655,403][753,476] } from pid 2060
W/InputManagerService( 2060): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@406d5eb0
D/dalvikvm( 6715): GC_CONCURRENT freed 245K, 51% free 3024K/6087K, external 0K/0K, paused 39ms+7ms
D/Tethering( 2060): TetheredState.processMessage what=4
I//system/bin/iptables( 1476): Flushing chain INPUT' I//system/bin/iptables( 1476): Flushing chainOUTPUT'
I//system/bin/iptables( 1476): Flushing chain FORWARD' I//system/bin/iptables( 1476): Flushing chainPREROUTING'
I//system/bin/iptables( 1476): Flushing chain POSTROUTING' I//system/bin/iptables( 1476): Flushing chainOUTPUT'
D/Tethering( 2060): Untethered tiap0
D/BluetoothNetworkService( 2060): updating tether state
D/Tethering( 2060): sendTetherStateChangedBroadcast 0, 0, 0
D/Tethering( 2060): TetherModeAliveState.processMessage what=2
D/TetherController( 1476): Stopping tethering services
I/dnsmasq (15576): exiting on receipt of SIGTERM
D/TetherController( 1476): Tethering services stopped
D/TetherController( 1476): Setting IP forward enable = 0
D/Tethering( 2060): notifying tethered with iface =null
D/dalvikvm( 2060): GC_EXTERNAL_ALLOC freed 1360K, 43% free 5771K/10055K, external 4223K/4252K, paused 124ms
I/ActivityManager( 2060): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10100000 cmp=org.jtb.alogcat/.LogActivity } from pid 2060
D/dalvikvm( 6715): GC_CONCURRENT freed 371K, 50% free 3051K/6087K, external 0K/0K, paused 18ms+4ms

And here bother me especially the following lines:
I//system/bin/iptables( 1476): Flushing chain INPUT' I//system/bin/iptables( 1476): Flushing chainOUTPUT'
I//system/bin/iptables( 1476): Flushing chain FORWARD' I//system/bin/iptables( 1476): Flushing chainPREROUTING'
I//system/bin/iptables( 1476): Flushing chain POSTROUTING' I//system/bin/iptables( 1476): Flushing chainOUTPUT'

My System:

Afwall 1.2.4.1
iptables 1.4.10
Android 2.3.7
Kernel 2.6.32.9
Mod CyanogenMod-7.2.0-umts_sholes GWK74

Network-interfaces:

ip6tnl0
lo
muxtest_net
psd_data10
psd_data6
psd_data7
psd_data8
psd_data9
rmnet0
sit0
usb0
usb1
cernekee added a commit to cernekee/afwall that referenced this issue May 12, 2013
…rfaces

Use the ConnectivityChangeReceiver for more than just roaming: any time
the system notifies us that the network configuration has changed, see if
any of the parameters relevant to AFWall+ have changed.  If so,
recalculate and reapply the firewall rules.

This should also address ukanth#134 (OUTPUT rules left wide open
after tethering is disabled).
cernekee added a commit to cernekee/afwall that referenced this issue May 13, 2013
…rfaces

Use the ConnectivityChangeReceiver for more than just roaming: any time
the system notifies us that the network configuration has changed, see if
any of the parameters relevant to AFWall+ have changed.  If so,
recalculate and reapply the firewall rules.

This should also address ukanth#134 (OUTPUT rules left wide open
after tethering is disabled).
cernekee added a commit to cernekee/afwall that referenced this issue May 13, 2013
…rfaces

Use the ConnectivityChangeReceiver for more than just roaming: any time
the system notifies us that the network configuration has changed, see if
any of the parameters relevant to AFWall+ have changed.  If so,
recalculate and reapply the firewall rules.

This should also address ukanth#134 (OUTPUT rules left wide open
after tethering is disabled).
@ukanth
Copy link
Owner

ukanth commented May 16, 2013

Merged 👍 This patches should resolve the issue.

@klarglas
Copy link
Author

Hello Umakanthan and cernekee,

thank you for your fast and good response. I donwloaded the beta-Version today from xda-developers (thank you for posting the apk there!). But unfortunately the problem is not solved. If I switch the Wireless Tethering, the iptable-Rules will be changed or flushed. A reboot didn't change anything.

I don't know enough Java, that I could really help you. Is there a possibility to apply the rules always, if there is a ConnectivityChange detected? Because not all users need it, it should be selecteable in the settings?

I would be very greatful, if you could solve the problem.
Elias

@ukanth
Copy link
Owner

ukanth commented May 22, 2013

I'll look into this issue. Thanks for the detailed log.

@cernekee
Copy link
Contributor

"Is there a possibility to apply the rules always, if there is a ConnectivityChange detected?"

When I enable tethering on JB 4.1 or 4.2, I typically get a couple of ConnectivityChange intents, including one when the wifi LAN connection is lost and another one when the interface comes back up as an AP. The rules do get flushed along the way but AFWall notices the interface/IP changes and re-applies them each time.

It would be helpful to post your output from: adb logcat -s "AFWall:*"

to see what messages pop up during the untethered->tethered transition. The AFWall beta should be used.

@klarglas
Copy link
Author

Wow, that was fast!

Again the logs with the AFWall 1.2.5. Beta.
I checked with iptables system and Busybox system and also with build-in iptables and build-in busybox without success.
Because I want to block tethering the entry "(Tethering) - DHCP+DNS services" is not allowed to access the internet. AFWall+ is allowed to access WLAN and 3G. Unfortunately I cannot upload the rules-file on github. I use a lager custom script, because I use AFWall in Whitelist-Mode an allow any app only for it own servers, which it really needs. Here at least the custom script:

# Allgemein
$IPTABLES --flush FORWARD
$IPTABLES --policy FORWARD DROP
$IPTABLES -A OUTPUT -m time --timestart 22:00 --timestop 6:00 -j DROP 
# Dr Oetker
$IPTABLES -A "afwall" -p TCP --destination-port 80 -m owner --uid-owner 10025 --destination "183.82.53.166/32" -j RETURN
$IPTABLES -A "afwall" -p TCP --destination-port 80 -m owner --uid-owner 10025 --destination "37.77.204.4/32" -j RETURN
# Chefkoch
$IPTABLES -A "afwall" -m owner --uid-owner 10028 --destination "185.13.208.0/24" -j RETURN 
# Google
# Todo: Alles von Google auf eine Chain umleiten. So kann ich einzelne Apps leichter für Google freigeben.
$IPTABLES -A "afwall" --destination "216.239.32.0/19" -j RETURN 
$IPTABLES -A "afwall" --destination "64.233.160.0/19" -j RETURN 
$IPTABLES -A "afwall" --destination "66.249.80.0/20" -j RETURN 
$IPTABLES -A "afwall" --destination "72.14.192.0/18" -j RETURN 
$IPTABLES -A "afwall" --destination "209.85.128.0/17" -j RETURN 
$IPTABLES -A "afwall" --destination "66.102.0.0/20" -j RETURN 
$IPTABLES -A "afwall" --destination "74.125.0.0/16" -j RETURN 
$IPTABLES -A "afwall" --destination "64.18.0.0/20" -j RETURN 
$IPTABLES -A "afwall" --destination "207.126.144.0/20" -j RETURN 
$IPTABLES -A "afwall" --destination "173.194.0.0/16" -j RETURN 
# Wetteronline
$IPTABLES -A "afwall" --destination "82.98.69.30/32" -j RETURN 
# Mitfahrgelegenheit (aus log: 62.146.42.160) 
$IPTABLES -A "afwall" -m owner --uid-owner 10021 --destination "62.146.42.160/32" -j RETURN 
$IPTABLES -A "afwall" -m owner --uid-owner 10021 --destination "119.161.80.12/32" -j RETURN 
# Koch Droid
$IPTABLES -A "afwall" -m owner --uid-owner 10027 --destination "85.25.120.96/32" -j RETURN 
$IPTABLES -A "afwall" -m owner --uid-owner 10027 --destination "91.103.142.0/24" -j RETURN 
$IPTABLES -A "afwall" -m owner --uid-owner 10027 --destination "119.161.80.12/32" -j RETURN 
# Wikipedia
$IPTABLES -A "afwall" --destination "208.80.152.0/23" -j RETURN 
$IPTABLES -A "afwall" --destination "91.198.174.0/24" -j RETURN 

It would be helpful to post your output from: adb logcat -s "AFWall:*"

I don't know how to execute this command. So I used the app alogcat and hope, that the result will be the same. If I filter for "AFWall" the result is empty. Only iptables will be found. But no changes to the logs with version 1.2.4.1.

Switch tethering on:

via aLogcat:
--------- beginning of /dev/log/system
[...]
--------- beginning of /dev/log/main
D/szipinf ( 2061): Initializing inflate state
D/szipinf ( 2061): Initializing inflate state
D/szipinf ( 2061): Initializing inflate state
D/szipinf ( 2061): Initializing inflate state
I/ActivityManager( 2061): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10100000 cmp=com.android.settings/.Settings } from pid 2061
W/InputManagerService( 2061): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@40821838
D/BluetoothNetworkService( 2061): updating tether state
D/BluetoothNetworkService( 2061): interface tiap0
D/Tethering( 2061): sendTetherStateChangedBroadcast 1, 0, 0
D/Tethering( 2061): interfaceAdded :tiap0
D/CommandListener( 1468): Setting iface cfg
D/NetworkManagmentService( 2061): rsp <213 00:00:00:00:00:00 0.0.0.0 0.0.0.0 [down broadcast multicast]>
D/NetworkManagmentService( 2061): flags <[down broadcast multicast]>
D/Tethering( 2061): Tethering tiap0
D/Tethering( 2061): InitialState.processMessage what=2
D/BluetoothNetworkService( 2061): updating tether state
D/Tethering( 2061): sendTetherStateChangedBroadcast 0, 0, 0
D/Tethering( 2061): Tethered tiap0
D/BluetoothNetworkService( 2061): updating tether state
D/Tethering( 2061): sendTetherStateChangedBroadcast 0, 1, 0
D/Tethering( 2061): MasterInitialState.processMessage what=1
D/Tethering( 2061): Tether Mode requested by tiap0 - TetheredState - Tethered - lastError =0
D/NetworkManagmentService( 2061): rsp <213 00:00:00:00:00:00 10.224.237.68 255.0.0.0 [up running]>
D/NetworkManagmentService( 2061): flags <[up running]>
D/Tethering( 2061): chooseUpstreamType(false), dunRequired =false, iface=rmnet0
D/Tethering( 2061): checking if hipri brought us this connection
D/Tethering( 2061): notifying tethered with iface =rmnet0
D/TetherController( 1468): Setting IP forward enable = 1
D/TetherController( 1468): Starting tethering services
D/TetherController( 1468): Tethering services running
D/TetherController( 1468): setDnsForwarders(0 = '8.8.8.8')
D/TetherController( 1468): setDnsForwarders(1 = '4.2.2.2')
D/TetherController( 1468): Sending update msg to dnsmasq [update_dns:8.8.8.8:4.2.2.2]
D/Tethering( 2061): TetheredState.processMessage what=12
I/dnsmasq (27263): started, version 2.51 cachesize 150
I/dnsmasq (27263): compile time options: no-IPv6 GNU-getopt no-DBus no-I18N DHCP no-scripts no-TFTP
W/dnsmasq (27263): warning: no upstream servers configured
I/dnsmasq (27263): DHCP, IP range 192.168.43.2 -- 192.168.43.254, lease time 1h
I/dnsmasq (27263): DHCP, IP range 192.168.42.2 -- 192.168.42.254, lease time 1h
I/tiap_loader(27261): Set property wlan.ap.driver.status = ok - Ok
I//system/bin/iptables( 1468): ACCEPT all opt -- in rmnet0 out tiap0 0.0.0.0/0 -> 0.0.0.0/0 state RELATED,ESTABLISHED
I//system/bin/iptables( 1468): ACCEPT all opt -- in tiap0 out rmnet0 0.0.0.0/0 -> 0.0.0.0/0
I//system/bin/iptables( 1468): MASQUERADE all opt -- in * out rmnet0 0.0.0.0/0 -> 0.0.0.0/0
D/dalvikvm( 2061): GC_EXTERNAL_ALLOC freed 192K, 45% free 5794K/10439K, external 4460K/4473K, paused 122ms
D/szipinf ( 2061): Initializing inflate state
D/szipinf ( 2061): Initializing inflate state
D/szipinf ( 2061): Initializing inflate state
D/szipinf ( 2061): Initializing inflate state
I/dnsmasq (27263): read /etc/hosts - 22032 addresses
I/dnsmasq (27263): using nameserver 4.2.2.2#53
I/dnsmasq (27263): using nameserver 8.8.8.8#53
D/SoftapController( 1468): Softap driver start: 0
I/hostap (27395): Configuration file: /data/misc/wifi/hostapd.conf
I/hostap (27395): _hostapd_init_iface_
I/hostap (27395): ctrl_interface_group=0
I/hostap (27395): HAPDTI wilink_init: enter
I/hostap (27395): BSS count 1, BSSID mask ff:ff:ff:ff:ff:ff (0 bits)
I/hostap (27395): HAPDTI wilink_wireless_event_init: enter
I/hostap (27395): HAPDTI wilink_get_we_version: enter
I/hostap (27395): SIOCGIWRANGE: WE(compiled)=22 WE(source)=19 enc_capa=0xf
I/hostap (27395): regulatory_build_hw_capability: Country=TI indx=4
I/hostap (27395): RATE[0] rate=10 flags=0x152
I/hostap (27395): RATE[1] rate=20 flags=0x152
I/hostap (27395): RATE[2] rate=55 flags=0x152
I/hostap (27395): RATE[3] rate=110 flags=0x152
I/hostap (27395): RATE[4] rate=60 flags=0x150
I/hostap (27395): RATE[5] rate=90 flags=0x150
I/hostap (27395): RATE[6] rate=120 flags=0x150
I/hostap (27395): RATE[7] rate=180 flags=0x150
I/hostap (27395): RATE[8] rate=240 flags=0x150
I/hostap (27395): RATE[9] rate=360 flags=0x150
I/hostap (27395): RATE[10] rate=480 flags=0x150
I/hostap (27395): RATE[11] rate=540 flags=0x150
I/hostap (27395): Passive scanning not supported
I/hostap (27395): Flushing old station entries
I/hostap (27395): Deauthenticate all stations
I/hostap (27395): HAPDTI wilink_sta_deauth: enter
I/hostap (27395): HAPDTI wilink_send_mgmt_frame: sending 26 byte MGMT frame to ff:ff:ff:ff:ff:ff
I/hostap (27395): MGMT - hexdump(len=26): c0 00 00 00 ff ff ff ff ff ff a4 ed 4e fd 5d b0 a4 ed 4e fd 5d b0 00 00 02 00
I/hostap (27395): l2_packet_send - sendto: Network is down
I/hostap (27395): Mode: IEEE 802.11g Channel: 11 Frequency: 2462 MHz
I/hostap (27395): Using interface tiap0 with hwaddr a4:ed:4e:fd:5d:b0 and ssid 'AndroidAP'
I/hostap (27395): PSK (ASCII passphrase) - hexdump_ascii(len=12):
I/hostap (27395): WPA: group state machine entering state GTK_INIT (VLAN-ID 0)
I/hostap (27395): GMK - hexdump(len=32): [REMOVED]
I/hostap (27395): GTK - hexdump(len=16): [REMOVED]
I/hostap (27395): WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0)
I/hostap (27395): Using existing control interface directory.
I/hostap (27395): HAPDTI wilink_commit: COMMIT
I/hostap (27395): tiap0: Setup of interface done.
I/hostap (27395): l2_packet_receive - recvfrom: Network is down
I/hostap (27395): l2_packet_receive - recvfrom: Network is down
I/ActivityManager( 2061): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10100000 pkg=org.jtb.alogcat cmp=org.jtb.alogcat/.LogActivity } from pid 2061
D/SoftapController( 1468): Softap startap - Ok
I/hostap (27395): RX ctrl_iface - hexdump_ascii(len=4):
I/hostap (27395): 50 49 4e 47 PING
D/SoftapController( 1468): tiwlan0 - tiap0 - AndroidAP - wpa2-psk - - (null)
I/hostap (27395): HAPDTI wilink_wireless_event_receive: enter
I/hostap (27395): HAPDTI wilink_wireless_event_rtm_newlink: enter
I/hostap (27395): HAPDTI wilink_wireless_event_receive: enter
I/hostap (27395): HAPDTI wilink_wireless_event_rtm_newlink: enter
I/hostap (27395): RX ctrl_iface - hexdump_ascii(len=8):
I/hostap (27395): 52 45 43 4f 4e 46 49 47 RECONFIG
I/hostap (27395): ***_hostapd_reconfig_iface_
I/hostap (27395): Flushing old station entries
I/hostap (27395): Deauthenticate all stations
I/hostap (27395): HAPDTI wilink_sta_deauth: enter
I/hostap (27395): HAPDTI wilink_send_mgmt_frame: sending 26 byte MGMT frame to ff:ff:ff:ff:ff:ff
I/hostap (27395): MGMT - hexdump(len=26): c0 00 00 00 ff ff ff ff ff ff a4 ed 4e fd 5d b0 a4 ed 4e fd 5d b0 00 00 02 00
I/hostap (27395): _hostapd_deinit_iface_
I/hostap (27395): Control interface directory not empty - leaving it behind
I/hostap (27395): HAPDTI wilink_wireless_event_deinit: enter
I/hostap (27395): HAPDTI wilink_deinit: enter
I/hostap (27395): _hostapd_init_iface_
I/hostap (27395): ctrl_interface_group=0
I/hostap (27395): HAPDTI wilink_init: enter
I/hostap (27395): BSS count 1, BSSID mask ff:ff:ff:ff:ff:ff (0 bits)
I/hostap (27395): HAPDTI wilink_wireless_event_init: enter
I/hostap (27395): HAPDTI wilink_get_we_version: enter
I/hostap (27395): SIOCGIWRANGE: WE(compiled)=22 WE(source)=19 enc_capa=0xf
I/hostap (27395): regulatory_build_hw_capability: Country=TI indx=4
I/hostap (27395): RATE[0] rate=10 flags=0x152
I/hostap (27395): RATE[1] rate=20 flags=0x152
I/hostap (27395): RATE[2] rate=55 flags=0x152
I/hostap (27395): RATE[3] rate=110 flags=0x152
I/hostap (27395): RATE[4] rate=60 flags=0x150
I/hostap (27395): RATE[5] rate=90 flags=0x150
I/hostap (27395): RATE[6] rate=120 flags=0x150
I/hostap (27395): RATE[7] rate=180 flags=0x150
I/hostap (27395): RATE[8] rate=240 flags=0x150
I/hostap (27395): RATE[9] rate=360 flags=0x150
I/hostap (27395): RATE[10] rate=480 flags=0x150
I/hostap (27395): RATE[11] rate=540 flags=0x150
I/hostap (27395): Passive scanning not supported
I/hostap (27395): Flushing old station entries
I/hostap (27395): Deauthenticate all stations
I/hostap (27395): HAPDTI wilink_sta_deauth: enter
I/hostap (27395): HAPDTI wilink_send_mgmt_frame: sending 26 byte MGMT frame to ff:ff:ff:ff:ff:ff
I/hostap (27395): MGMT - hexdump(len=26): c0 00 00 00 ff ff ff ff ff ff a4 ed 4e fd 5d b0 a4 ed 4e fd 5d b0 00 00 02 00
I/hostap (27395): Mode: IEEE 802.11g Channel: 11 Frequency: 2462 MHz
I/hostap (27395): Using interface tiap0 with hwaddr a4:ed:4e:fd:5d:b0 and ssid 'AndroidAP'
I/hostap (27395): SSID - hexdump_ascii(len=9):
I/hostap (27395): 41 6e 64 72 6f 69 64 41 50 AndroidAP
I/hostap (27395): PSK (ASCII passphrase) - hexdump_ascii(len=12):
I/hostap (27395): WPA: group state machine entering state GTK_INIT (VLAN-ID 0)
I/hostap (27395): GMK - hexdump(len=32): [REMOVED]
I/hostap (27395): GTK - hexdump(len=16): [REMOVED]
I/hostap (27395): WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0)
I/hostap (27395): Using existing control interface directory.
I/hostap (27395): HAPDTI wilink_commit: COMMIT
I/hostap (27395): tiap0: Setup of interface done.
I/hostap (27395): HAPDTI wilink_wireless_event_receive: enter
I/hostap (27395): HAPDTI wilink_wireless_event_rtm_newlink: enter
I/hostap (27395): wilink_rx_mgmt: received MGMT with len 302 from 20:37:06:7c:df:81
I/hostap (27395): MGMT - hexdump(len=304): 00 00 80 00 00 00 ff ff ff ff ff ff 20 37 06 7c df 81 20 37 06 7c df 81 50 6f 22 50 4a 55 43 00 00 00 66 00 31 04 00 07 77 65 62 2d 70 73 6b 01 06 98 24 30 48 60 6c 03 01 0b 05 04 00 01 01 00 07 06 44 45 20 01 0d 14 0b 05 03 00 08 8d 5b 2a 01 00 2d 1a 2c 18 1b ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30 18 01 00 00 0f ac 02 02 00 00 0f ac 02 00 0f ac 04 01 00 00 0f ac 02 28 00 3d 16 0b 00 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 85 1e 02 00 8f 00 0f 00 ff 03 59 00 61 70 2d 33 77 2d 34 37 32 00 00 00 00 00 00 00 03 00 00 3a dd 18 00 50 f2 01 01 00 00 50 f2 02 01 00 00 50 f2 02 01 00 00 50 f2 02 00 00 dd 18 00 50 f2 02 01 01 80 00 03 a4 00 00 27 a4 00 00 42 43 5e 00 72 32 2f 00 dd 06 00 40 96 01 01 04 dd 05 00 40 96 03 05 dd 05 00 40 96 0b 09 dd 05 00 40 96 14 09 dd 1d 00 40 96 0c 03 f2 78 6c 8d 85 ba 3e 01 00 00 f7 69 17 00 00 00 cc 32 6d 86 40 91 69 a9
I/hostap (27395): HAPDTI wilink_rx_mgmt: processing management frame
I/hostap (27395): station is not found20:37:06:7c:df:81
I/hostap (27395): wilink_rx_mgmt: received MGMT with len 302 from 20:37:06:6c:86:a1
I/hostap (27395): MGMT - hexdump(len=304): 00 00 80 00 00 00 ff ff ff ff ff ff 20 37 06 6c 86 a1 20 37 06 6c 86 a1 f0 f5 22 c0 73 55 43 00 00 00 66 00 31 04 00 07 77 65 62 2d 70 73 6b 01 06 98 24 30 48 60 6c 03 01 0b 05 04 00 01 00 00 07 06 44 45 20 01 0d 14 0b 05 02 00 0b 8d 5b 2a 01 00 2d 1a 2c 18 1b ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30 18 01 00 00 0f ac 02 02 00 00 0f ac 02 00 0f ac 04 01 00 00 0f ac 02 28 00 3d 16 0b 00 05 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 85 1e 03 00 8f 00 0f 00 ff 03 59 00 61 70 2d 33 77 2d 33 36 39 61 00 00 00 00 00 00 02 00 00 3a dd 18 00 50 f2 01 01 00 00 50 f2 02 01 00 00 50 f2 02 01 00 00 50 f2 02 00 00 dd 18 00 50 f2 02 01 01 80 00 03 a4 00 00 27 a4 00 00 42 43 5e 00 72 32 2f 00 dd 06 00 40 96 01 01 04 dd 05 00 40 96 03 05 dd 05 00 40 96 0b 09 dd 05 00 40 96 14 09 dd 1d 00 40 96 0c 03 f2 78 96 81 85 ba 3e 01 00 00 02 6a 17 00 00 00 b6 19 82 5c 85 2c 6f cf
[...]

Switch tethering off:

via aLogcat:
--------- beginning of /dev/log/system
[...]
I/ActivityManager( 2061): Starting: Intent { act=android.intent.action.MAIN cmp=com.android.settings/.WirelessSettings } from pid 13520
I/ActivityManager( 2061): Starting: Intent { act=android.intent.action.MAIN cmp=com.android.settings/.TetherSettings } from pid 13520
D/NetworkManagmentService( 2061): rsp <213 00:00:00:00:00:00 0.0.0.0 0.0.0.0 [down broadcast multicast]>
D/NetworkManagmentService( 2061): flags <[down broadcast multicast]>
I/ActivityManager( 2061): Start proc com.cyanogenmod.cmparts for broadcast com.cyanogenmod.cmparts/.intents.LEDNotificationReceiver: pid=17296 uid=1000 gids={1015, 3002, 3001, 3003}
D/NetworkManagmentService( 2061): rsp <213 00:00:00:00:00:00 10.224.237.68 255.0.0.0 [up running]>
D/NetworkManagmentService( 2061): flags <[up running]>
[...]
--------- beginning of /dev/log/main
[...]
I/hostap (17434): HAPDTI wilink_rx_mgmt: processing management frame
I/hostap (17434): station is not found20:37:06:7c:df:81
I/hostap (17434): wilink_rx_mgmt: received MGMT with len 302 from 20:37:06:6c:86:a1
I/hostap (17434): MGMT - hexdump(len=304): 00 00 80 00 00 00 ff ff ff ff ff ff 20 37 06 6c 86 a1 20 37 06 6c 86 a1 50 2a 22 f8 28 02 43 00 00 00 66 00 31 04 00 07 77 65 62 2d 70 73 6b 01 06 98 24 30 48 60 6c 03 01 0b 05 04 00 01 00 00 07 06 44 45 20 01 0d 14 0b 05 01 00 08 8d 5b 2a 01 00 2d 1a 2c 18 1b ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30 18 01 00 00 0f ac 02 02 00 00 0f ac 02 00 0f ac 04 01 00 00 0f ac 02 28 00 3d 16 0b 00 05 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 85 1e 00 00 8f 00 0f 00 ff 03 59 00 61 70 2d 33 77 2d 33 36 39 61 00 00 00 00 00 00 01 00 00 3a dd 18 00 50 f2 01 01 00 00 50 f2 02 01 00 00 50 f2 02 01 00 00 50 f2 02 00 00 dd 18 00 50 f2 02 01 01 80 00 03 a4 00 00 27 a4 00 00 42 43 5e 00 72 32 2f 00 dd 06 00 40 96 01 01 04 dd 05 00 40 96 03 05 dd 05 00 40 96 0b 09 dd 05 00 40 96 14 09 dd 1d 00 40 96 0c 03 f2 78 4d 84 85 ba 3e 01 00 00 ec 98 16 00 00 00 7c 3b d7 9d 82 a4 06 c3
I/hostap (17434): HAPDTI wilink_rx_mgmt: processing management frame
I/hostap (17434): station is not found20:37:06:6c:86:a1
D/Tethering( 2061): TetheredState.processMessage what=4
I//system/bin/iptables( 1468): Flushing chain INPUT' I//system/bin/iptables( 1468): Flushing chainOUTPUT'
I//system/bin/iptables( 1468): Flushing chain FORWARD' I//system/bin/iptables( 1468): Flushing chainPREROUTING'
I//system/bin/iptables( 1468): Flushing chain POSTROUTING' I//system/bin/iptables( 1468): Flushing chainOUTPUT'
D/Tethering( 2061): Untethered tiap0
D/BluetoothNetworkService( 2061): updating tether state
D/Tethering( 2061): sendTetherStateChangedBroadcast 0, 0, 0
D/Tethering( 2061): TetherModeAliveState.processMessage what=2
D/TetherController( 1468): Stopping tethering services
I/dnsmasq (17298): exiting on receipt of SIGTERM
D/TetherController( 1468): Tethering services stopped
D/TetherController( 1468): Setting IP forward enable = 0
D/Tethering( 2061): notifying tethered with iface =null
D/szipinf ( 2061): Initializing inflate state
D/szipinf ( 2061): Initializing inflate state
D/szipinf ( 2061): Initializing inflate state
D/szipinf ( 2061): Initializing inflate state
I/ActivityManager( 2061): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10100000 pkg=org.jtb.alogcat cmp=org.jtb.alogcat/.LogActivity } from pid 2061
[...]

@cernekee
Copy link
Contributor

Strange, I don't see any connectivity change broadcasts at all. AFWall should log a debug message for each one. Do you see any "connectivity_changed" log messages when you enable/disable airplane mode?

Maybe we will need to also listen for ACTION_TETHER_STATE_CHANGED.

BTW the log contains your WPA PSK password in hex, so you'll probably want to change it.

@klarglas
Copy link
Author

BTW the log contains your WPA PSK password in hex, so you'll probably want to change it.

Thank you for that hint!

OK, here the logs for switching airplane-mode on and off. Here looks everthing ok and the rules have been applied correctly.

First all entries for AFWall:

I/ActivityManager( 2061): Start proc dev.ukanth.ufirewall for broadcast dev.ukanth.ufirewall/.ConnectivityChangeReceiver: pid=888 uid=10038 gids={1015, 3003}
D/AFWall  (  888): received connectivity_changed intent
I/AFWall  (  888): Now assuming NO connection (all interfaces down)
D/su      (  908): 10038 dev.ukanth.ufirewall executing 0 /system/bin/sh using shell /system/bin/sh : sh
D/su      (  922): 10038 dev.ukanth.ufirewall executing 0 /system/bin/sh using shell /system/bin/sh : sh
D/AFWall  (  888): applyRules: success

I/ActivityManager( 2061): Start proc dev.ukanth.ufirewall for broadcast dev.ukanth.ufirewall/.ConnectivityChangeReceiver: pid=4799 uid=10038 gids={1015, 3003}
D/AFWall  ( 4799): received connectivity_changed intent
I/AFWall  ( 4799): Now assuming 3G connection (non-tethered)
D/su      ( 4824): 10038 dev.ukanth.ufirewall executing 0 /system/bin/sh using shell /system/bin/sh : sh
D/su      ( 4837): 10038 dev.ukanth.ufirewall executing 0 /system/bin/sh using shell /system/bin/sh : sh
D/AFWall  ( 4799): applyRules: success

And here the full log, slightly shortened: (at pastebin for a better overview)
http://pastebin.com/u9sfhbK6

@klarglas
Copy link
Author

I made furthermore three tests now, but with litte additional information:

  1. Switch off and on the mobile data connection. AFWall will be notified and applies the rules.
  2. Switch WLAN on and off. But don't establish a connection. (At the moment I have no wlan.) AFWall won't be notiefied, but also the rules won't be changed.
  3. Activate and deactivate the switch for use only 2G-Networks. AFWall won't be notiefied, but also the rules won't be changed.

@ukanth
Copy link
Owner

ukanth commented May 24, 2013

As cernekee mentioned, we might need to add ACTION_TETHER_STATE_CHANGE to apply the rule on tether state change.

@ukanth
Copy link
Owner

ukanth commented Mar 18, 2014

This issue is resolved.

@ukanth ukanth closed this as completed Mar 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants