Skip to content

netfilter: logging cleanups

Florian Westphal netfilter-devel 3 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest6 patches 0 repliesNew
  2. v26 patches 0 repliesSuperseded
  3. v16 patches 0 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6netfilter: nf_log: remove dead ARPHRD_SIT handling from MAC/HW header loggingnet/netfilter/nf_log_syslog.c net/netfilter/nfnetlink_log.c+3 -220 replies
2/6netfilter: nf_log_syslog: fix MAC header dump to use real header lengthnet/netfilter/nf_log_syslog.c+9 -60 replies
3/6netfilter: nfnetlink_log: fix up dev_parse_header usagenet/netfilter/nfnetlink_log.c net/netfilter/nfnetlink_log_common.h net/netfilter/nfnetlink_queue.c+129 -280 replies
4/6netfilter: nfnetlink_log: use real mac header length for hwheadernet/netfilter/nfnetlink_log.c+62 -130 replies
5/6netfilter: nfnetlink: don't log hwaddr/hwheader on output hooksnet/netfilter/nfnetlink_log.c net/netfilter/nfnetlink_queue.c+40 -60 replies
6/6netfilter: nfnetlink_log: only add timestamp on the input pathnet/netfilter/nfnetlink_log.c+17 -80 replies

Reviews trailers per patch

1 of 6 patches has a Reviewed-by or Acked-by.

PatchFernando Fernandez Mancera
1/6
2/6R-b
3/6
4/6
5/6
6/6

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH nf-next v3 0/6] netfilter: logging cleanups

v3: more LLM cargo-culting: add a random READ_ONCE() in patch 3. As a result, changelog of patch 3 become even more unreadable LLM text wall.

At this point I am seriously considering 'TL;AI'
as the new default commit changelog; no human will ever read these.

Patches other than 3 are unchanged.

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 | 121 +++++++++++++++++++++
 net/netfilter/nfnetlink_queue.c      |  19 +---
 4 files changed, 248 insertions(+), 71 deletions(-)
 create mode 100644 net/netfilter/nfnetlink_log_common.h
Signature · 1 line
2.56.1