Skip to content

netfilter: logging cleanups

Florian Westphal netfilter-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4netfilter: nf_log: remove dead ARPHRD_SIT handling from MAC/HW header loggingnet/netfilter/nf_log_syslog.c net/netfilter/nfnetlink_log.c+4 -251 reply
2/4netfilter: nf_log_syslog: fix MAC header dump to use real header lengthnet/netfilter/nf_log_syslog.c+10 -51 reply
3/4netfilter: nfnetlink_log: fix up dev_parse_header usagenet/netfilter/nfnetlink_log.c net/netfilter/nfnetlink_log_common.h net/netfilter/nfnetlink_queue.c+107 -281 reply
4/4netfilter: nfnetlink_log: rework mac header loggingnet/netfilter/nfnetlink_log.c+54 -140 replies

Reviews trailers per patch

2 of 4 patches have a Reviewed-by or Acked-by.

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

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

Read the v1 thread

Cover letter [PATCH nf 0/4] netfilter: logging cleanups

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
Signature · 1 line
2.56.0