195 points · by kevincox · 2y ago · 119 comments
I've seen worse than that. A firewall dropping the first fragment based on the UDP port number (which is available in the first fragment), but allowing further fragments.
I'd love to see their new discovery algorithm get widely distributed, it's 2024, and a lot of stuff still breaks or suffers terrible delays if I don't apply the proper settings with my 1492 MTU.
I just use 1024 since nobody seems to use SLIP anymore. It should fit under 1200 with headers and the logic is similar to DEC 512+64 limit arrived at initially. All the PMTU detection algos suffer from something lowering the MTU along a route for a long lasting connection.
This is, of course, nonsense on so many levels, but it was very effective, because my servers at the time had a ridiculous IP fragment reassembly buffer (autoscaled based on system ram size, with a formula written decades ago) and reassembly did a linear search of the buffer. No big deal in normal conditions when we got one or two fragmented packets a minute; immensely terrible when getting a couple GBps of fragmented chargen reflection that could never be reassembled. Setting the reassembly buffer to the minimum solved the problem; during DDoS attacks, legitimate fragments wouldn't be reassembled, but oh well, so many other services don't ever assemble fragments, we did the best we could.
What are other cases where fragmentation truly makes sense?
IPv6 moves to an end-to-end fragmentation model, but even then the right answer is to negotiate in a higher level protocol a maximum segment size for the path you're talking on, and then just avoid fragmentation entirely. Fragmentation is an absolutely wretched stream transport protocol!
Perhaps not, but with quantum-safe signature algorithms on the horizon, signatures are about to get much longer again.
I had multiple issues with WireGuard related to MTU/fragmentation. Once, service reported that a system is pingable, but the management website didn't load. I was able to SSH into it, but similarily, the connection broke everytime I tried to run `ip addr` or view logs. Commands with short output worked, however – apparently, somewhere on the path the packets got fragmented and/or dropped without notice.
I actually hit this recently, where I wasn't able to stream videos from certain sites over Wireguard. I spend a while with tcpdump and figured out that they were using Fastly as a CDN, Fastly was sending 1500 byte packets marked with Don't Fragment, my Wireguard endpoint was returning a message saying that the maximum packet size for the link was 1460 bytes, and Fastly was then… sending another 1500 byte packet marked Don't Fragment. To their credit when I was able to provide their engineering with logs showing this was clearly a Fastly problem, they fixed it fairly promptly
regarding credit; did you get paid for doing their homework?
Maybe for UDP for protocols where the designers were really optimistic. IMHO, for DNS if you want it to work as much as possible, your queries and responses should fit in 512 bytes, or some people are going to have problems on some networks. DNS over TCP doesn't work everywhere, even if it's supposed to.
It's more palatable to require DNS over TCP or working UDP over fragmented IP if it's for big txt records like for mail, but if your A and/or AAAA records don't fit in 512 bytes, expect lingering problems that are hard to track down.
I guess you could just say '1480 for all time' and be done with it
router A <-> switch B <-> switch C <-> router D
Router A still needs to have a reliable, actively updating, way to detect the path MTU to Router D because something could change and the path turns into: router A <-> switch E <-> switch C <-> router D
where switch E has a different MTU than the other equipment. Now you could go even further back and say the same happens for anything IP transits on top of but then the folks at Xerox PARC would probably wonder why the hell you're trying to make their hubs so damn smart and expensive and the people after them would probably wonder why the hell you're telling them to throw backwards compatibility with all the previous gear out the window in the name of making MTU slightly simpler.It's a decent solution I think you just have the time backwards - it's something we should look to do as we move towards the future and the overhead of such logic is tiny to add to networking rather than something to wish we had in the past when even dumb hubs were expensively complicated.
This does leave one case unhandled though: you end up with a low MTU path at some point, things update so your traffic is going over a high MTU path, you still need to have some algorithm to discover this or the connection never recovers the performance.
If you want a world where you can rely on an L2 to have a way to handle the MTU mismatch then nothing is being solved by this other than the ability to say "fragmentation is not not in the current abstraction layer anymore, it's now an annoying problem on the layer below it instead" :).
2. You at least get some information. Maybe half a packet is better than no packet.
3. You get an exact size limit of the entire path the packet took. Rather than just a "too big" of the first hop that wouldn't pass it.
Overall I think it is a pretty decent solution. Assuming that the IP header says the original size or similar so that the truncation can be easily detected.
I do see some flaws though:
1. Layered protocols would have to be more complex to deal with packet truncation. (Although I guess they could simply treat truncation the same as dropped to avoid extra complexity.)
2. Checksums at the end of a packet being dropped likely make the whole packet useless.
3. It may be better to get a quick rejection from a local router rather than the possibly far away peer.
All these advantages would come from truncation being "in-band", following the same path as the data packets, instead of being a special "out-of-band" message like ICMP packets are.
As for the flaws you listed:
1. The main complexity would come not from dealing with truncation itself (as you said, just treat it the same as a dropped packet), but from each protocol having to reflect the "truncated size" back to the original sender (like how ECN deals with marked packets).
2. The whole packet is not useless, the reason for truncating instead of turning it into an empty packet is to keep as much as possible of the higher layer headers. That is, most of the packet might be useless, but the higher layer headers at the start can be useful.
3. On the other hand, you might need several of these "quick" rejections before arriving at the ideal size.
ICMP does send the hop MTU, it's not just a "too big" signal. (But I do acknowledge that you're going for the PMTU in a single shot, and that's slightly neater.)
The fallback for anything (one way, lazy, filtered connection, truly anything) is you always have your minimum MTU where the protocol is guaranteed to work at a given size and if it's not the protocol knows the solution will need to lie outside itself. IPv4/IPv6 already have this today.
If your route looks like this,
E_a -- MTU 1500 --> R_1 -- MTU 1200 --> R_2 -- MTU 1000 -> E_b
Where E_a & E_b are the endpoints, with two routers. There PMTU is 1000; if you first emit a 1500 B packet with DF, R_1 will drop it, and emit an ICMP with the next hop MTU of 1200. You then have to emit another packet, and get another ICMP response from R_2 with the MTU of 1000, and now you know the PMTU, but it takes two failures to get there.OP's suggestion is a single round trip: you emit a 1500 B packet, E_b receives a truncated 1000 B packet. E_b responds to E_a saying "that got truncated to 1000 B" and now E_a knows the PMTU, in a single shot. In an simple design, we can call the truncated packet "worthless" and force E_a to repeat it with the right PMTU, but it's still only too a single packet from E_a to elicit the right value for the PMTU from the network.
At that nosebleed speed, FPGA is designed to do such defragmentation of IP as well as assembly of UDP reassembly and TCP desegmentation.
Very fast.
Including a bulk of FPGA dedicated to the overlapping payload that hackers often play tricks on such IDS, et. al.
That is probably the ONLY beef I have with RFCs covering IP/TCP/UDP: did not detail what to do in event of overlapping packets (first overlapped takes precedence or last overlapped overrides old data?)
For a correctly operating sender, it shouldn't matter, since the data should be identical. It would be the same as asking what should happen if the sender changes the data when retransmitting a packet (the only difference from overlapping fragments is that a retransmitted packet has 100% overlap). It's Undefined Behavior, the receiver is allowed to do anything it wants, and the sender can't complain since it's its own fault.
(Also consider that packets are always allowed to be reordered in transit, so what you thought was the first packet might become the last packet on the next hop; even if the standard constrained the reassembly ordering, you might still not get the result you expected.)
With even more live updating of newly added Aho-Corrasick and Regex algorithm into the FPGA.
The boxes do run into very interesting problems and knowledge space though, just more on the inverse of the problem at hand (how to properly act like a client receiving already fragmented data).
That decision alone would’ve made fragments so much simpler on network devices and appliances, and much less likely for them to get dropped.
For packets that don't want to use it, this is just 1 byte of overhead to set the size to 0.
(None of this would fix the real problem with fragmentation, which is that you can't efficiently segment out a large frame without having some kind of reliability layer).
You don't even really need that, and as proof, take ICMP ... which was designed as part of IP ... actually does do this. Routers are already required to copy and include the header of the packet that triggered an ICMP error.
Keep in mind, most routers don't even bother supporting existing fragmentation because it's costly to implement in high speed hardware. So while you could theoretically have that dynamic next protocol header length value field it'd only be complicating something hardware makers already think is too complicated to be worth it. Making things unappealing complex is one of the common results of layering violations.
Do most routers really do that, or just the ones which are also trying to act as a firewall?
Doesn't that make it more one of those situations where the non-documented behavior has become the de facto standard, rather than "wrong" exactly? (I guess it depends on whether that decision is being made consciously by the implementors or just for lack of knowledge of the standards.)
I guess you could provision the router cpus so they could send ICMPs for line rate incoming packets that must be dropped, but that doesn't seem like a good cost tradeoff.
> IP_PMTUDISC_WANT will fragment a datagram if needed according to the path MTU, or will set the don't-fragment flag otherwise.
And then the quiz asks for the DF bit in the former case. The docs don't say; one could illogically assume the DF is unset in the former case … and in fact, that seems to be the case, though this leaves me wondering why it would do that, since with DF unset, it won't elicit the needed ICMP responses. There still remain some cases, of course, where we could do that (the latter case in the docs) … but this seems inefficient. In the former case, why wouldn't we fragment according to the PMTU and just set DF in all cases?
Sure, the delivery mechanisms are quite a bit different - but not that much if we were to speak of a case of a packet fitting into two fragments…
Why or why not?
In fact, now that I think about it... what happens if a TCP/IP connection is initiated from another country to a TCP/IP address inside of an outwardly blocked country?
Would that act similar to a NAT punchthrough, but on a Nation-State's firewall?
Think about it this way... let's take an arbitrary example, China...
And let's suppose for the purposes of discussion that what the western Mainstream Media says about China's Internet is completely true -- that outgoing connections to the West from China -- are blocked.
OK, but there still is Alibaba -- the equivalent of China's Amazon.com.
Connections FROM the West (e-commerce connections, "we buy from you", "you are a merchant to us", etc., etc.) TO Alibaba.com (in China) -- are not blocked, and would NOT be blocked by the Chinese government!
Why?
Because anywhere there's trade -- if the trade is beneficial to the government in question (anyone heard of taxes, anyone? They benefit the government you know!) -- there will be internal political pressure NOT to prevent that trade from occurring!
So let's say that a TCP/IP connection that looked like a legitimate e-commerce connection -- was initiated FROM the West, to an IP address in China for a legitimate Chinese e-commerce site...
Now, couldn't that connection, once established (since it is, after all bi-directional) -- be used to send data outside of China?
Yes!
But to only one outside/external IP address!
But what if that IP address on the Western side (being in a non-firewalled country) -- now could somehow route that data to any other IP address around the world?
Sort of like a VPN -- but the connection is opened up from an INCOMING connection, not an outgoing one...
Would that be the equivalent of NAT punchthrough -- for a Nation State's firewall?
?
Before you answer, I'm guessing that there are Deep State bots (from all countries!) that will try to derail this conversation...
That's a testament to "always think for yourself" (let logic be your guide!) -- stay away from so called "expert" opinions, especially one or two sentence "no it can't be done" or "it would never work" replies by fake posters with fake names from fake accounts!
But, I guess we'll open up the floor to the AI powered agenda-driven bots... foreign and domestic! :-)
Also, note that I don't suggest/condone that anyone actually do any of the above -- this discussion is theoretical in scope only!
VPNs work pretty much all the same regardless of which "direction" the tunnel is opened in, its still just normal VPN. Heck, you don't even need a open connection for a VPN, IP itself is stateless and connectionless.
Um, conspiracy theories aside, Alibaba has servers in the US.
Point is, if there's a way out, then there's a way in...
How does the data on the Alibaba servers in the U.S. get updated? Probably not by carrier pigeon... Someone (or a group of people) in the Alibaba offices in China updates that server when prices change, when new products are added, etc., etc.
And how does that happen, if there isn't an outgoing Internet connection?
And if so, then that's proof of a non-blocked outgoing connection from China.
And if that's true, then we need to raise the question of which types of outgoing connections are selectively permitted from China (because obviously the Alibaba update on U.S. servers is permitted!)
Which would in turn start to crumble the western mainstream media narrative that China blocks all outgoing connections...
In other words, if China doesn't block all outgoing connections, then we need to know (if we care at all about global Internet censorship) which types of connections are blocked, which ones aren't, and what the exact criteria for a blocked or permitted connection is...
Because if you are correct, then it would seem that connections from mainland China to Alibaba's U.S. servers are NOT blocked...
Conspiracy theories aside!
Try reading the basic Wikipedia articles for starters:
https://en.wikipedia.org/wiki/Internet_censorship_in_China
https://en.wikipedia.org/wiki/Great_Firewall
https://en.wikipedia.org/wiki/List_of_websites_blocked_in_ma...
That question was raised decades ago, and the answer is already known: traffic which sufficiently disagrees with the current government of China is blocked.
>Which would in turn start to crumble the western mainstream media narrative that China blocks all outgoing connections
I have never seen anyone (other than you) claim that China blocks all outgoing connections. That seems to be your narrative, rather than some mythical, conspiratorial, "western mainstream media narrative". I don't think it does us any good to invent divisive narratives like this. You could instead invent narratives that unite people and ideas and nations.
The reality that the world realizes, is that the current government of China blocks traffic containing content telling narratives which sufficiently disagree with them, using the tool they developed specifically for that purpose.
Titles like these sound unnecessarily arrogant to me and are off-putting.
Of course, it really depends on whether you can actually back this up! And in this case Val does, quite clearly.
Yes indeed; and reading the article, she does not sound that arrogant:
"Many networking experts think they know when IP fragmentation will happen, and I thought I did too—until I had to implement an algorithm for a VPN"