netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipv4: Fix log message for martian source
@ 2025-11-26 21:59 Clara Engler
  2025-11-28  2:17 ` Jakub Kicinski
  0 siblings, 1 reply; 7+ messages in thread
From: Clara Engler @ 2025-11-26 21:59 UTC (permalink / raw)
  To: netdev, linux-kernel; +Cc: davem, dsahern, edumazet, kuba, pabeni, horms, cve

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)


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-12-01 21:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-26 21:59 [PATCH] ipv4: Fix log message for martian source Clara Engler
2025-11-28  2:17 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).