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

[ISSUE] DHCP Broadcasts blocked - adb connection drops #1149

Closed
Uj947nXmRqV2nRaWshKtHzTvckUUpD opened this issue Oct 10, 2020 · 2 comments
Closed
Labels

Comments

@Uj947nXmRqV2nRaWshKtHzTvckUUpD
Copy link

Uj947nXmRqV2nRaWshKtHzTvckUUpD commented Oct 10, 2020

Android System (1000) is being blocked periodically (i think when dhcp ip renew is about to happen).

Denied 12 times in one hour (from firewall logs):

wlan0
Dest: 255.255.255.255:67
Host: 255.255.255.255
Source: 192.168.0.X:68 (my phone's wlan ip)
Protocol UDP

I am on Android 10 rooted with magisk ( + edpxosed module ) and issue occurs on both 3.4.0 and 3.5.0 beta 1 versions .

My afwall configuration is one 'whitelist mode' and I only allow selected. For System(pid 1000) LAN and VPN is allowed only.

Note that some days ago I was having full connection drops without recovering when fully blocking PID 1000 on LAN. i was seeing blocked connections from my ip:68 towards 192.168.100.1:67 (my gateway = my router's ip). After allowing it on LAN, these are gone, only broadcasts are blocked.

Adb wifi connection drops with errors (from logcat):

10-10 04:53:04.955 1693 2312 V AlarmManager: Triggering alarm #0: 2 when =2965835 package =com.android.networkstack.inprocess operation = null listenTag =DhcpClient.wlan0.KICK flags =0x9
10-10 04:53:04.957 1693 2898 D DhcpClient: Broadcasting DHCPREQUEST ciaddr=192.168.0.X request=0.0.0.0 serverid=null
10-10 04:53:04.959 1693 2898 E DhcpClient: Can't send packet:
10-10 04:53:04.959 1693 2898 E DhcpClient: android.system.ErrnoException: sendto failed: EPERM (Operation not permitted)
10-10 04:53:04.959 1693 2898 E DhcpClient: at libcore.io.Linux.sendtoBytes(Native Method)
10-10 04:53:04.959 1693 2898 E DhcpClient: at libcore.io.Linux.sendto(Linux.java:225)
10-10 04:53:04.959 1693 2898 E DhcpClient: at libcore.io.ForwardingOs.sendto(ForwardingOs.java:193)
10-10 04:53:04.959 1693 2898 E DhcpClient: at libcore.io.BlockGuardOs.sendto(BlockGuardOs.java:358)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.system.Os.sendto(Os.java:522)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.net.dhcp.DhcpClient.transmitPacket(DhcpClient.java:463)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.net.dhcp.DhcpClient.sendRequestPacket(DhcpClient.java:500)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.net.dhcp.DhcpClient.access$2600(DhcpClient.java:116)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.net.dhcp.DhcpClient$DhcpReacquiringState.sendPacket(DhcpClient.java:1053)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.net.dhcp.DhcpClient$PacketRetransmittingState.processMessage(DhcpClient.java:787)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.net.networkstack.util.StateMachine$SmHandler.processMsg(StateMachine.java:992)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.net.networkstack.util.StateMachine$SmHandler.handleMessage(StateMachine.java:809)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.os.Handler.dispatchMessage(Handler.java:107)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.net.networkstack.util.WakeupMessage.onAlarm(WakeupMessage.java:133)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.app.AlarmManager$ListenerWrapper.run(AlarmManager.java:263)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.os.Handler.handleCallback(Handler.java:883)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.os.Handler.dispatchMessage(Handler.java:100)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.os.Looper.loop(Looper.java:214)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.os.HandlerThread.run(HandlerThread.java:67)
10-10 04:53:04.965 1693 2898 D DhcpClient: doQuit
10-10 04:53:04.968 1693 2898 D ApfFilter: (wlan0): shutting down

Let me know if more info is needed, I am glad to provide it.

@Uj947nXmRqV2nRaWshKtHzTvckUUpD
Copy link
Author

I managed to workaround the issue with a custom script set in afwall:
iptables -I afwall-wifi 1 -o wlan0 -s 192.168.0.0/16 -d 255.255.255.255 -p udp --sport 68 --dport 67 -j ACCEPT -m comment --comment "Allow DHCP request broadcast"

#supposing that your lan is somewhere in 192.168.0.0/16

Still, this doesn't answer the question why this occurs? Is it a bug?
@ukanth Can you please shed some light on this . Thank you!

@ukanth
Copy link
Owner

ukanth commented Mar 7, 2021

Have you enabled DHCP from the list ?

@ukanth ukanth added Followup and removed Review labels Mar 7, 2021
@ukanth ukanth closed this as completed Apr 18, 2021
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

2 participants