Let's code a TCP/IP stack (2016)
saminiir.com
saminiir.com
Let's code a TCP/IP stack, 1: Ethernet & ARP (2016) - https://news.ycombinator.com/item?id=17316487 - June 2018 (47 comments)
Let's Code a TCP/IP Stack: TCP Retransmission - https://news.ycombinator.com/item?id=14701199 - July 2017 (30 comments)
Let's code a TCP/IP stack, 1: Ethernet and ARP - https://news.ycombinator.com/item?id=11234229 - March 2016 (49 comments)
The good thing though was that you got a guaranteed 64k rather than the vagueries of a 56k modem that in practice never actually worked at 56k, more like 30-45k depending on phone line quality.
On top of that you could (if your wallet was fat enough) get ISDN30 (E1) which was akin to a T1 but ~500k faster.
I did a fair amount of commissioning of these things back in the 90's.
WCIII was p2p IIRC so this let me play ranked matches against EU players.
Shout out to anyone who remembers “Warcraft III ZAF-1” — I swear that sequence of characters is burned into my muscle memory.
https://www.saminiir.com/lets-code-tcp-ip-stack-2-ipv4-icmpv...
https://www.saminiir.com/lets-code-tcp-ip-stack-3-tcp-handsh...
https://www.saminiir.com/lets-code-tcp-ip-stack-4-tcp-data-f...
https://www.saminiir.com/lets-code-tcp-ip-stack-5-tcp-retran...
This kind of overhead seems so unnecessary and alienating.
At least things like ifr_flags are easy to read, easy to type, and unique enough you ca search for them.
On the flipslide, Smalltalk, also developed in the 1970s, has much longer names. But Smalltalk was developed for the Xerox Alto (https://en.wikipedia.org/wiki/Xerox_Alto), an expensive machine with a bitmapped display, luxurious even by 1980s standards. Lisp also gradually embraced longer names as technology improved; compare the early Lisps of the early 1960s to Common Lisp, which first appeared in the mid 1980s.
C and Unix are products of their relatively spartan environments from the early 1970s, whereas Java, a product of the 1990s, was influenced by Smalltalk, which was born under less austere conditions.
Long selectors in Smalltalk make sense as they're split and interleaved with arguments. Even a single programmer would probably write the same code for both environments differently when it comes to naming things.
But why do we still have to suffer in 2021?
The Github code today is somewhat more complicated to follow.
If you know of any tutorials that walk through a TCP/IP stack with all relevant code I'd love to hear of it.
Also Jeremy Bentham's TCP/IP Lean: Web Servers for Embedded Systems is pretty good.
Operating System Design, Vol. 2: Internetworking with Xinu, ISBN-13: 978-0136374145 (https://www.amazon.com/Operating-System-Design-Vol-Internetw...).
Unfortunately, this book was written in 1987, so it's a bit dated (e.g. no IPv6). I think it's still useful to learn the basics of a TCP/IP implementation.
If all you're saying is that TCP/IP has, among its many goals, a separation of concerns, sure. But most major systems designs have separations of concerns.
This is partly why QUIC is based on UDP instead TCP. You don't have all the information needed at the TCP layer to do the kind of optimizations that QUIC does.
Say you have a backend tcp http REST app that takes requests to modify a widget. To receive the request, the payload will pass over a series of networks and protocols, all with potentially different restrictions and modifications, until it gets to a load balancer, and then maybe a service mesh router, to a network service listening on the node of some container orchestrator, and finally read by the backend app.
All of the layers will have been replaced numerous times, and possibly the actual data payload modified. But the only thing your backend app knows is the final state. And then, somewhere along the way, there is an error. It could have happened anywhere along the chain, for who knows why. But you and the app server won't know when or where or why the error happened because none of the information about the changing layers (or network operations along the way) is carried along.
If the entire stack were not actually a stack, but instead a kind of commit log of transactions and instructions, we could see every single step in a transaction (ideally verified by cryptographic checksum). This would make it faster to diagnose problems and allow automation to work around known issues - in addition to making it harder for attackers to mess with traffic. In the simplest examples it would look like a stack, but for more complex paths it would look like a log. We could also potentially use this method to do away with service meshes.
I cannot imagine that would ever be acceptable for most companies.