From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH nf 0/4] netfilter: logging cleanups
Date: Fri, 30 Oct 2026 16:44:29 +0100 [thread overview]
Message-ID: <20261030154433.13601-1-fw@strlen.de> (raw)
A few patches to address LLM-reported issues.
While working on those LLM also reported that ARPHRD_SIT is dead
code, so:
1) Remove dead ARPHRD_SIT branches from MAC/HW header logging in
nf_log_syslog.c and nfnetlink_log.c. The paths are unreachable ever
since SIT tunnel hard_header_len was set to zero 6 years ago.
Then there are the originally reported issues:
2) Fix MAC header dump in nf_log_syslog to base the byte count on
skb_mac_header_len() clamped to dev->hard_header_len. Prevent logging
IP/IPv6 header bytes as part of the MAC address when the actual MAC header
is shorter than the device's hard header.
3) Extract dev_parse_header usage into a shared helper for nfnetlink_log and
nfnetlink_queue, clamping hw addresses to 8 bytes and validating the skb
mac header. Add BUILD_BUG_ON checks to assert identical container struct
layouts.
4) Use skb_mac_header_len when dumping mac headers in nfnetlink_log and
clamp to hard_header_len.
Skip mac header logging at POST_ROUTING where the header still belongs
to the ingress device. Originally POST_ROUTING never had incoming
device handed to it, but that changed. Make it stricter again.
Florian Westphal (4):
netfilter: nf_log: remove dead ARPHRD_SIT handling from MAC/HW header
logging
netfilter: nf_log_syslog: fix MAC header dump to use real header
length
netfilter: nfnetlink_log: fix up dev_parse_header usage
netfilter: nfnetlink_log: rework mac header logging
net/netfilter/nf_log_syslog.c | 24 ++-----
net/netfilter/nfnetlink_log.c | 90 ++++++++++++++++---------
net/netfilter/nfnetlink_log_common.h | 99 ++++++++++++++++++++++++++++
net/netfilter/nfnetlink_queue.c | 18 ++---
4 files changed, 167 insertions(+), 64 deletions(-)
create mode 100644 net/netfilter/nfnetlink_log_common.h
--
2.56.0
next reply other threads:[~2026-10-30 15:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-30 15:44 Florian Westphal [this message]
2026-10-30 15:44 ` [PATCH nf 1/4] netfilter: nf_log: remove dead ARPHRD_SIT handling from MAC/HW header logging Florian Westphal
2026-10-30 15:44 ` [PATCH nf 2/4] netfilter: nf_log_syslog: fix MAC header dump to use real header length Florian Westphal
2026-10-30 15:44 ` [PATCH nf 3/4] netfilter: nfnetlink_log: fix up dev_parse_header usage Florian Westphal
2026-10-30 15:44 ` [PATCH nf 4/4] netfilter: nfnetlink_log: rework mac header logging Florian Westphal
2026-10-31 18:34 ` [PATCH nf 0/4] netfilter: logging cleanups Florian Westphal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261030154433.13601-1-fw@strlen.de \
--to=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox