Linux Netfilter development
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH nf 1/4] netfilter: nf_log: remove dead ARPHRD_SIT handling from MAC/HW header logging
Date: Fri, 30 Oct 2026 16:44:30 +0100	[thread overview]
Message-ID: <20261030154433.13601-2-fw@strlen.de> (raw)
In-Reply-To: <20261030154433.13601-1-fw@strlen.de>

dump_mac_header() in nf_log_syslog.c and the HWHEADER dump in
nfnetlink_log.c special-case ARPHRD_SIT devices by backing the header
pointer up by ETH_HLEN before dumping dev->hard_header_len bytes, on
the assumption that a SIT tunnel's "hard header" covers the
underlying device's real Ethernet header plus the tunnel's IPv4
header.

That is no longer the case: ever sice commit 8ef9ba4d6666 ("IPv6: Set
SIT tunnel hard_header_len to zero"), dev->hard_header_len is 0 and
these branches are dead code.

No bug report in 6 years, so lets remove those branches.

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 net/netfilter/nf_log_syslog.c | 23 +++--------------------
 net/netfilter/nfnetlink_log.c |  6 +-----
 2 files changed, 4 insertions(+), 25 deletions(-)

diff --git a/net/netfilter/nf_log_syslog.c b/net/netfilter/nf_log_syslog.c
index c3fd398ffcd7..3ff5a49a1c8d 100644
--- a/net/netfilter/nf_log_syslog.c
+++ b/net/netfilter/nf_log_syslog.c
@@ -820,26 +820,9 @@ static void dump_mac_header(struct nf_log_buf *m,
 		const unsigned char *p = skb_mac_header(skb);
 		unsigned int i;
 
-		if (dev->type == ARPHRD_SIT) {
-			p -= ETH_HLEN;
-
-			if (p < skb->head)
-				p = NULL;
-		}
-
-		if (p) {
-			nf_log_buf_add(m, "%02x", *p++);
-			for (i = 1; i < dev->hard_header_len; i++)
-				nf_log_buf_add(m, ":%02x", *p++);
-		}
-
-		if (dev->type == ARPHRD_SIT) {
-			const struct iphdr *iph =
-				(struct iphdr *)skb_mac_header(skb);
-
-			nf_log_buf_add(m, " TUNNEL=%pI4->%pI4", &iph->saddr,
-				       &iph->daddr);
-		}
+		nf_log_buf_add(m, "%02x", *p++);
+		for (i = 1; i < dev->hard_header_len; i++)
+			nf_log_buf_add(m, ":%02x", *p++);
 	}
 	nf_log_buf_add(m, " ");
 }
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index d923f2cb1398..0b590c117f4c 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -610,11 +610,7 @@ __build_packet_message(struct nfnl_log_net *log,
 
 		hwhdrp = skb_mac_header(skb);
 
-		if (skb->dev->type == ARPHRD_SIT)
-			hwhdrp -= ETH_HLEN;
-
-		if (hwhdrp >= skb->head &&
-		    nla_put(inst->skb, NFULA_HWHEADER,
+		if (nla_put(inst->skb, NFULA_HWHEADER,
 			    skb->dev->hard_header_len, hwhdrp))
 			goto nla_put_failure;
 	}
-- 
2.56.0


  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 [PATCH nf 0/4] netfilter: logging cleanups Florian Westphal
2026-10-30 15:44 ` Florian Westphal [this message]
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-2-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