[PATCH] ipv4: Fix log message for martian source

From: Clara Engler

Date: Wed Nov 26 2025 - 17:00:09 EST


From: Clara Engler <cve@xxxxxx>

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@xxxxxx>
---
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)