Hacker News new | ask | show | jobs
Curious case of Martian traffic in Linux (pavel.network)
51 points by pavel_odintsov 1133 days ago
8 comments

It's not correct that the modern Linux kernel refuses to forward packets with a source address in 0.0.0.0/8. The only address that it refuses to forward this way is 0.0.0.0/32.

I just got a patch into the ip(7) man page that describes this

https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/...

although there hasn't been a man-pages release since then, so you probably can't see this on your own system yet.

The original change (included in Linux 5.3) is

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin...

(I'm working on a project that aims to make these addresses potentially useful for numbering Internet hosts in the future, as part of which Dave Taht's patch linked above was written, so I follow this very closely!)

Separately, you need to be able to process a 0.0.0.0/32 source address on external interfaces (though not to forward it) in order to be able to implement a DHCP server, as that's the source address used by DHCP clients. (edit: another commenter pointed out that this commonly uses raw sockets so it doesn't necessarily require any explicit kernel support)

May dhcp client/servers are using raw sockets and will thus bypass incorrect firewall config/martian packet filtering.
Yes, I forgot about that but you're right that that's the typical implementation method.

So the DHCP case does not necessarily need any special kernel support (other than not prefiltering before the raw socket).

Thanks for the correction.

Is there any similar work to change 127/8 to be something more reasonable like 127/16 or 24?
We have proposed it!

https://www.ietf.org/archive/id/draft-schoen-intarea-unicast...

The big prize is 240/4.

https://www.ietf.org/archive/id/draft-schoen-intarea-unicast...

Our proposals have not been warmly received in the intarea WG so far.

I think it is pretty reasonable to be reluctant to make such changes because it may well break stuff.
Well, for 240/4 in particular we (in a very expansive sense of "we"¹) started making the change back in 2008 in response to

https://datatracker.ietf.org/doc/pdf/draft-fuller-240space-0...

If we (for an expansive sense of "we") had kept it up more actively, we would already have had 15 years of progress on updating implementations and evolving people's expectations. That wouldn't have been a super-fast change, necessarily.

We (for a narrow sense of "we") think it's pretty likely that people will still be interested in having more IPv4 space in 15 years from now, so it's too bad that progress is (somewhat) stalled on this (with most Unix-like systems allowing it, and Windows not allowing it, and dedicated routers from before about 2013-2016 often not allowing it).

¹ the specific project I'm working on, started by John Gilmore, didn't exist yet at that time, but is trying to revive/continue this idea

Fair enough, but that more or less emphasizes my point: if it wasn't done by 2010 or so that means that a ton of IoT hardware has now shipped that may never see updates and that would possibly end up failing when presented with such a departure from what the expected behavior was at the time the hardware was shipped. You change old established standards at your peril, especially how IPV4 is routed and which ranges are reserved. There are quite a few things that retrospectively could have been handled better and a large number of huge ranges got handed out like candy back in the day. Some of those have been reclaimed and some still remain. It may be easier and with less chance of breaking stuff if those ranges were reclaimed more aggressively.
I use 127/8 for local services, because ports are a very scarce resource. In this respect ip6 is a complete no go.
What would use 1.04e+12 ports? Each IP has about 65k ports IIRC and 127/8 is 16m addresses.
I select one 127/16 network for all my addresses - a vendor namespace. Each service can have worker processes, they get 127/24 networks.
SELinux reserves them for unknown reasons. For all addresses.
A martian is a packet that has a source address in a network for which the interface it's arriving on isn't configured. They're not restricted to 0/8; they can have just about any source address.

> The best way to fix this issue is to change Netflow / IPFIX / sFlow agent configuration on device to use another legitimate IP address instead of 0.0.0.0.

Um, yes. 0.0.0.0 looks like a really bad choice of source address.

"martian" isn't an official term from the RFCs, and is terrible usage. If linux is not running on mars at the moment (perhaps in the Chinese rover?) it surely will be in the not too distant future. And a router in orbit may need to distinguish between martian and terrestrial traffic.

Which the code can easily do of course, but a foolish name like this could confuse someone debugging code during development, or worse while debugging a communication problem in process far away.

(BTW this is an earnest, not humorous comment).

Martian is an official term from the RFC's, though? It's mentioned in section 5.3.7 of RFC 1812 from 1995. That happens to be the exact section of the exact RFC with the recommendation whose kernel implementation is shown in the article. It seems to be fairly established terminology, having sat in that RFC for the last 28 years.
Thanks! It wasn't in the ones I looked at.

Darn, it's still a short-sighted choice. Even "interstellar" would be good for another 75 years or so ( https://i4is.org/what-we-do/technical/project-dragonfly/ ), though "intergalactic" would be better, even if ipv6 were used.

Jump it in the middle with "intergalactic planetary, planetary intergalactic" packets and nobody can think it's actually from space.
“TilBrooklyn” would be less confusing.
To me it does not seem like it would arise in similar enough contexts to be confusing.

"Martian" meaning the planet would come up in application code, not in the kernel. Why would the kernel even have that concept?

It’s an argument to sysctl, for example, which could confuse someone on earth trying to configure something far away.

> sudo sysctl net.ipv4.conf.all.log_martians=1

sysctl is kernel parameters though, right? I just can't imagine being confused by that, it's too divorced from anything that would care what planet it's on.
I was hoping this was somebody with network equipment in NASA, seeing actual DSN traffic over their network...
> It's relatively tricky to read as text and you may prefer to look on screenshot of my console

If you copy it from the console and then use a `<pre>` tag rather than a `<blockquote>` tag it'll work well.

See here: https://i.imgur.com/gAsb9TR.png

It's Ghost, so Markdown's available, and you could use a triple-backtick block, ``` before and after.
I thought this was about actual interplanetary networking. Can we change the title to be less clickbait and more informative?
Martian traffic is a common term among network engineers (or at least among the ones who work at/with ISPs): https://en.wikipedia.org/wiki/Martian_packet
Yeah, but I think that WP page is wrong.

It relies on the page Reserved_IP_addresses, implying that a martian is a packet with a source address within certain ranges. In fact a martian is a packet with a source address for which the receiving interface isn't configured; any address could be a martian, depending on how the interface is set up.

Hey, if I'm wrong, please set me straight.

Looking at RFC1812, Martian packets [1] seems to be reserved addresses only.

What you're talking about is referred to as source address validation [2] also known as strict reverse path forwarding (RPF) [3].

[1] https://datatracker.ietf.org/doc/html/rfc1812#section-5.3.7

[2] https://datatracker.ietf.org/doc/html/rfc1812#section-5.3.8

[3] https://datatracker.ietf.org/doc/html/rfc3704#section-2.2

I don't think I've ever seen the specific form "Martian traffic", but "packet from Mars" or "Martian packet" is an established idiom for packets arriving on "impossible" interfaces (e.g. a packet from 192.168.x.x arriving on a publicly routed interface).
https://en.wikipedia.org/wiki/Martian_packet

A quick usenet search shows references to the term back into the 90's.

The RFC which defines the term is from 1995, so it's been established enough to find its way into an RFC 28 years ago.
If one reads RFC 1812, one finds that it does not exactly define the term. It uses it in a heading but doesn't use it in a way that agrees with its later definition of "martian", since its explanation of "martian address filtering" encompasses traffic that is not "martian" per its own glossary.

A contemporary definition that is not self-contradictory is in Eric S. Raymond's New Hacker's Dictionary, published four years earlier; but which isn't what RFC 1812 says either, however.

So whilst the people who weren't alive in the 1990s are wrong to be hung up on the "I thought it meant 'from Mars'." confusion, since the saddening reality of 2023 is that we're no nearer to that being a realistic source of confusion than we were in 1991; the obverse of the coin is that, like much of the Jargon File, it's woolly slang set over-hard into stone by Eric S. Raymond and a document from Cisco that it is unwise to rely upon for strict technical meaning.

> So whilst the people who weren't alive in the 1990s are wrong to be hung up on the "I thought it meant 'from Mars'." confusion, since the saddening reality of 2023 is that we're no nearer to that being a realistic source of confusion than we were in 1991;

There’s a Mars Fleet of about 11 operational spacecraft and robotic landers/rovers/etc on or around Mars right now, and in fact the robotic helicopter, Ingenuity, runs Linux. I legitimately thought it was related to those. There were no operational missions at Mars in 1991.

https://svs.gsfc.nasa.gov/4414

https://en.wikipedia.org/wiki/List_of_missions_to_Mars

"Runs Linux" is superficial thinking, though. ("Runs Linux" doesn't equate to "uses the Internet Protocol".) There is no more Internet Protocol connectivity to Mars in 2023 than there was in 1991. There is no realistic prospect of this being a possible source of confusion now, in the near future, or possibly ever at the current rate.
https://pavel.network/content/images/2023/04/drop.png

Why can't RFCs be readable by default? Why do they still have explicit line- and page-breaks and fixed-width fonts?

Why would the external device use this ip in the first place?