From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH nf-next v2 0/6] netfilter: logging cleanups
Date: Wed, 18 Nov 2026 12:57:26 +0100 [thread overview]
Message-ID: <20261118115732.9529-1-fw@strlen.de> (raw)
v2: LLM cargo-culting and more paranoia checks.
Couldn't find any place where skb->dev == NULL && indev != NULL, but
I consider logging slowpath so I just gave up and had LLM blindly
follow AI/sashiko "advice".
See patches for details.
1) Remove dead ARPHRD_SIT special-casing from MAC/HW header logging in
nf_log_syslog and nfnetlink_log. The branch became unreachable once SIT
tunnel hard_header_len was zeroed.
2) Fix MAC header dump in nf_log_syslog to use skb_mac_header_len() clamped
to dev->hard_header_len instead of unconditionally logging hard_header_len
bytes, preventing reads into the IP/IPv6 header.
3) Refactor hw address extraction into a shared helper for nfnetlink_log and
nfnetlink_queue. Clamp dev_parse_header() result to 8 bytes and validate
skb preconditions in the common helper. Add BUILD_BUG_ON assertions for
identical container struct layouts.
4) Use skb_mac_header_len() from indev instead of hard_header_len from
skb->dev for NFULA_HWHEADER length. Omit the NFULA_HWHEADER attribute when
the computed length is zero.
5) Skip hwheader logging on output hooks where the MAC header is stale. Gate
emission with a family-and-hook aware nfulnl_pre_egress() check.
6) Emit the nfnetlink_log timestamp only on the input path, since output-path
skb->tstamp may carry an SO_TXTIME delivery deadline rather than an
observation time. Replace the broken raw hooknum comparison with
nfulnl_pre_egress() so ARP and NETDEV families no longer emit timestamps
at their output hooks.
Florian Westphal (6):
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: use real mac header length for hwheader
netfilter: nfnetlink: don't log hwaddr/hwheader on output hooks
netfilter: nfnetlink_log: only add timestamp on the input path
net/netfilter/nf_log_syslog.c | 28 ++---
net/netfilter/nfnetlink_log.c | 151 ++++++++++++++++++++-------
net/netfilter/nfnetlink_log_common.h | 117 +++++++++++++++++++++
net/netfilter/nfnetlink_queue.c | 19 +---
4 files changed, 244 insertions(+), 71 deletions(-)
create mode 100644 net/netfilter/nfnetlink_log_common.h
--
2.56.1
next reply other threads:[~2026-11-18 11:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 11:57 Florian Westphal [this message]
2026-11-18 11:57 ` [PATCH nf-next v2 1/6] netfilter: nf_log: remove dead ARPHRD_SIT handling from MAC/HW header logging Florian Westphal
2026-11-18 11:57 ` [PATCH nf-next v2 2/6] netfilter: nf_log_syslog: fix MAC header dump to use real header length Florian Westphal
2026-11-18 11:57 ` [PATCH nf-next v2 3/6] netfilter: nfnetlink_log: fix up dev_parse_header usage Florian Westphal
2026-11-18 11:57 ` [PATCH nf-next v2 4/6] netfilter: nfnetlink_log: use real mac header length for hwheader Florian Westphal
2026-11-18 11:57 ` [PATCH nf-next v2 5/6] netfilter: nfnetlink: don't log hwaddr/hwheader on output hooks Florian Westphal
2026-11-18 11:57 ` [PATCH nf-next v2 6/6] netfilter: nfnetlink_log: only add timestamp on the input path 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=20261118115732.9529-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.