ukanth / afwall

AFWall+ (Android Firewall +) - iptables based firewall for Android

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[ISSUE] AFWall+ v3.6.0 Duplicate Rules in Chain "afwall" Defined by Custom Script after Switching Interface

coldspring67 opened this issue · comments

*** Issue ***
After switching the interface the rules in chain "afwall" from a custom script are duplicated.

*** Steps to reproduce the problem ***

  1. Clear custom script in AFWall+
  2. Wifi on and 4G off
  3. Define a custom script which adds one or more rules to chain "afwall":
    a) Define a rule directly (e.g. "IPTABLES=/system/bin/iptables; $IPTABLES -A "afwall" -d 22.22.22.0/21 -j REJECT") or
    b) Include a script with rules (e.g. ". /data/local/rules.sh")
  4. Wifi off
  5. 4G on -> the rules in chain "afwall" from custom script are there twice
  6. 4G off
  7. Wifi on -> the rules in chain "afwall" from custom script are there three times

*** Expected behaviour ***
The rules in chain "afwall" from custom script are there once even after switching interface, because:
"Please note that all those chains [afwall etc.] are guaranteed to be cleared before the custom script is executed, so you don't need to worry about rules cleanup on your script IF you are using those chains." (https://github.com/ukanth/afwall/wiki/CustomScripts#adding-custom-rules)

*** Hard- and software ***
Device: Samsung Galaxy S5 SM-G900F
Android OS: LineageOS v18.1 (Android 11)
AFWall+: v3.6.0 from F-Droid (profile mode: whitelist)
Superuser: Magisk v24.3

Please let me know, if further information is needed.

Thank you, ukanth for great work!

I'm seeing a similar behavior adding a rule to afwall-wifi chain