From: Clara Engler <cve@cve.cx>
To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: davem@davemloft.net, dsahern@kernel.org, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, cve@cve.cx
Subject: [PATCH] ipv4: Fix log message for martian source
Date: Wed, 26 Nov 2025 22:59:58 +0100 [thread overview]
Message-ID: <aSd4Xj8rHrh-krjy@4944566b5c925f79> (raw)
From: Clara Engler <cve@cve.cx>
At the current moment, the log message for packets with a martian source
IP address is wrong. In fact, the current syntax looks as follows:
```
martian source <DESTINATION> from <SOURCE>, on dev <DEV>
```
This is wrong because `<SOURCE>` and `<DESTINATION>` need to be swapped.
Another verification for this claim can be seen when looking at the
(correct) implementation for logging packets with a martian destination
IP address, which happens to be identical, as it can be seen in line
2477 on the same file.
Signed-off-by: Clara Engler <cve@cve.cx>
---
net/ipv4/route.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index b549d6a57307..913de56d2c2d 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1796,7 +1796,7 @@ static void ip_handle_martian_source(struct net_device *dev,
* the only hint is MAC header.
*/
pr_warn("martian source %pI4 from %pI4, on dev %s\n",
- &daddr, &saddr, dev->name);
+ &saddr, &daddr, dev->name);
if (dev->hard_header_len && skb_mac_header_was_set(skb)) {
print_hex_dump(KERN_WARNING, "ll header: ",
DUMP_PREFIX_OFFSET, 16, 1,
--
2.50.1 (Apple Git-155)
next reply other threads:[~2025-11-26 22:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-26 21:59 Clara Engler [this message]
2025-11-28 2:17 ` [PATCH] ipv4: Fix log message for martian source Jakub Kicinski
2025-11-28 16:47 ` Clara Engler
2025-11-28 18:47 ` Jakub Kicinski
2025-12-01 18:54 ` Clara Engler
2025-12-01 19:40 ` Jakub Kicinski
2025-12-01 21:35 ` Clara Engler
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=aSd4Xj8rHrh-krjy@4944566b5c925f79 \
--to=cve@cve.cx \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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