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] IPv6 support missing in nflog utility #1232

Open
pedro042 opened this issue Aug 16, 2021 · 3 comments
Open

[ISSUE] IPv6 support missing in nflog utility #1232

pedro042 opened this issue Aug 16, 2021 · 3 comments
Labels

Comments

@pedro042
Copy link

Describe the bug
nflog binary (probably) doesn't support IPv6. See line 179 in external/nflog/nflog.c Hardcoded IPv4 format. IPv6 netlink messages are interpreted as IPv4 messages.

Firewall Logs
See investigation https://forum.xda-developers.com/t/5-0-root-3-5-2-afwall-iptables-firewall-16-may-2021.1957231/page-314#post-85484565 and messages bellow

Smartphone (please complete the following information):

  • Device: Oneplus 7t pro
  • Android 11,: [LOS 18.1 ]

Additional context
Consider update the nflog utility

@bsdice
Copy link

bsdice commented Aug 26, 2021

Compare https://github.com/WireGuard/wg-dynamic/blob/master/lease.c#L432 for an example of switching between IPv4 and IPv6. Bit of a task to get log_cb() to parse IPv6 correctly.

Update: Reason why NFLOG works and LOG doesn't, on my phone, appears to be a kernel configuration issue. On my Pixel 5 with stock LineageOS 18.1 kernel LOG does not work. Later today I flashed the "Proton Kernel" from https://github.com/kdrag0n/proton_kernel_redbull/releases and LOG suddenly sprung to life. Its curator @kdrag0n really really knows what he is doing: kdrag0n/proton_kernel_redbull@4b577a6

So solution here seems to be to find a better kernel. MiPa kernel on Xiaomi Mi is good, and this one for Pixel series. Or file a bug report with LineageOS developers.

Maybe Afwall could dig into /proc or sysctl and determine if LOG is available, and if not, warn user. Also warn that NFLOG is not IPv6 capable and will produce erroneous log entries with things like "protocol 128".

@pedro042
Copy link
Author

pedro042 commented Aug 29, 2021

Interesting. But on my phone LOG target works. Example:
08-29 16:42:20.356 0 0 W : [20210829_16:42:20.355699]@1 {AFL}IN= OUT=tun1 SRC=192.168.90.202 DST=192.168.90.1 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=55779 DF PROTO=TCP SPT=47368 DPT=8118 WINDOW=65535 RES=0x00 SYN URGP=0 OPT (020405B40402080A3D84D7AA0000000001030309) UID=10218 GID=10218 MARK=0x1a6
but Afwall probably can't parse it.
I use "stock" LOS kernel.

@selurvedu
Copy link

Is this fixed by #1375?

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

4 participants