afwall icon indicating copy to clipboard operation
afwall copied to clipboard

rules fail to apply and device reboots on network connectivity change

Open en-kanashi opened this issue 5 years ago • 17 comments

any sort of network change; disabling/enabling data, mobile connecting to different tower etc often causes the phone to soft reboot (doesnt start from the logo screen) This happens irrespective of the rules applied and almost always when mobile data is enabled (after disabling it)

  • Device: Motorola
  • Android OS: RROS 8.6.3 and 7.xx (Based on LOS 15 and 16)

Module enabled in edexposed, logging disabled,startup script disabled (tho changing it makes no difference)

By the looks of it i think it is a kernel crash (im not sure about this fact sorry im a noob) bcoz i see the the screen displays the last thing on it for less than a second before rebooting. At times device will start from reboot, afwall applies its rules and fails and the same cycle starts. This cycle sometimes ends when i delete the rules disable firewall rules and reapply them. IPv4rules.log Managed to get this just before it was about to reboot

en-kanashi avatar Jan 10 '21 12:01 en-kanashi

disabling ipv6 support stops the reboots but doesn't stop it from failing to apply rules. can someone tell me what this might mean, does disabling ipv6 have any disadvantages? Is there a better way to fix this?

en-kanashi avatar Jan 15 '21 04:01 en-kanashi

I'm having this trouble (soft reboot on connectivity change) as well. My phone is a OnePlus 5T running the latest Lineage 17.1, and disabling AFwall+ makes the problem go away.

I'm not using Xposed, but I do have the phone rooted with Magisk.

bthylafh avatar Jan 21 '21 01:01 bthylafh

Same issue here after upgrading to Android 11 on Samsung S10

schwabelbauch avatar Jan 29 '21 07:01 schwabelbauch

Thanks for the logs, seems like kernel does not support iptables filters and some other firewall is interfering with AFWall+ Others, please send the logcat to see the problem much deeper.

ukanth avatar Mar 07 '21 10:03 ukanth

Hi, i'm having the same issue on a mpst recent kernel. Info:

Issue appears as soon as i update kernel, at the moment i'm using an old version of MCD kernel (december)

Attached you will find log + screenshots of my actual setup.

The issue persists even if:

  1. selecting "allow selected" or "block selected"
  2. using iptables auto, system or inbuilt
  3. using busybox binary system or inbuilt

Thanks! screenshots.zip afwall.txt

urgali avatar Mar 08 '21 16:03 urgali

Thanks. I will add support for iptables-legacy. Seems like new version of iptables does not support few options.

ukanth avatar Mar 08 '21 16:03 ukanth

Can you confirm this path exists ?

/usr/sbin/iptables-legacy /usr/sbin/ip6tables-legacy

ukanth avatar Mar 08 '21 16:03 ukanth

No, seems not: root@fajita:/ # touch /usr/sbin/iptables-legacy touch: '/usr/sbin/iptables-legacy': No such file or directory root@fajita:/ # touch /usr/sbin/ip6tables-legacy
touch: '/usr/sbin/ip6tables-legacy': No such file or directory

you can see it here: root@fajita:/ # ls -alh | grep usr
root@fajita:/ #

urgali avatar Mar 08 '21 17:03 urgali

Have you tried using iptables as inbuilt and reapply rules ?

ukanth avatar Mar 08 '21 17:03 ukanth

Yeah, the issue persists in every possible combination:

  • inbuilt busybox and inbuilt iptables
  • system busybox and inbuilt iptables
  • system busybox and system iptables
  • inbuilt busybox and system iptables

urgali avatar Mar 08 '21 18:03 urgali

Let me know if i can help further :)

urgali avatar Mar 09 '21 14:03 urgali

can you switch to system busybox and system iptables and apply rules and export the rules ?

ukanth avatar Mar 09 '21 16:03 ukanth

Done

I could not export rules since i received "export failed" (you can check it in "export_failed" screenshot)

Also, i took log1.txt (log right after changing to sys iptables and sys busybox and apply) and log2.txt (taken after export failed); they could be abit messy though, i was forced to send them over via telegram since it couldn't export them in phone memory (just like export failed)

log2.txt log1.txt error-rules export_failed

urgali avatar Mar 09 '21 17:03 urgali

Seems it is an issue on the "owner" of UID to me

the ip_tables_matches on older kernel realease (which is working) has the following conf: root@fajita:/ # cat /proc/net/ip_tables_matches
u32 time string statistic state quota pkttype owner mac limit helper conntrack conntrack conntrack connlimit comment bpf bpf connmark mark rpfilter ah icmp socket socket socket socket quota2 policy multiport length iprange ttl hashlimit hashlimit esp ecn tos dscp udplite udp tcp root@fajita:/ # cat /proc/net/ip_tables_matches | grep owner owner

where the new file with a newer kernel release does not have owner match: root@fajita:/ # cat /proc/net/ip_tables_matches
u32 time string statistic state quota pkttype mac limit helper conntrack conntrack conntrack connlimit comment bpf bpf connmark mark rpfilter ah icmp socket socket socket socket quota2 policy multiport length iprange ttl hashlimit hashlimit esp ecn tos dscp udplite udp tcp root@fajita:/ # cat /proc/net/ip_tables_matches | grep owner
root@fajita:/ #

urgali avatar Mar 15 '21 14:03 urgali

@urgali Hello, i think i have solved this, at least for our kernel. I compared the old and new branch defconfig and found that CONFIG_NETFILTER_XT_MATCH_OWNER was not set. Flipped it to yes, compiled and flashed, now afwall doesn't throw out any error. Sorry everyone for going slightly off topic.

wannaskoo avatar Mar 15 '21 14:03 wannaskoo

I can confirm this was the issue, compiling the kernel with the flag make everyhting work.

Only issue remaining seems i'm not able to export afwall backup: EXPORT FAILED open failed: EPERM (operation not permitted)

urgali avatar Mar 15 '21 20:03 urgali

Solved with latest beta pre-beta build :D

We can mark this issue as Solved!

urgali avatar Mar 17 '21 22:03 urgali