This is still the header! Main site

Mobile IP

2021/01/29

... this is part 3 in the "Sockets are Stupid" series. There is a Part 1 and a Part 2, too.

I really thought I already dislike sockets and their stupid two-byte addresses to the greatest extent possible. And then I encountered The world in which IPv6 was a good design by Avery Penvarr. It's a great article, with a lot of internet history and some analysis of why things look like the way they do (which is a lot worse than what they could look like). There is an interesting point he makes about ipv6 and TCP ports though.

Namely... with ipv4 and TCP, if you hop from one access point / wifi network / etc to another, all your connections break, because they're established between (address, port number) pairs, not just ports themselves. Which is something that ipv6 did not fix.

What's somewhat surprising is how simple it'd be to fix this. If each end of the connection used only the port number to identify the connection, you could change your IP address, message the other side, which could then update info on where you are, and send upcoming responses to the new address. IP addresses could become only a place to reach you at right now, not your identity itself, as far as the connection is concerned.

Fun fact: e.g. OpenVPN can do this right now. To establish a site-to-site connection, you only have to give one side the IP of the other side; from that time, everything is reasonably symmetrical, and will just keep working even if one of the sides changes its IP. It's all UDP packets, so the side that did not move still gets all the packets and can re-address packets originating from it to the new IP of the other side.

Now, imagine a world in which we somehow didn't come up with the thought that a two-byte number is somehow a reasonable way of naming all the possible pipe endpoints on a computer. Let's say, it was full file system endpoints. (... imagine if you could actually connect to something using an address that'd look like... some.computer.net/file/system/path. This looks weirdly familiar for some reason.) Of course, it'd be fairly obvious that you can't just put this entire path into every packet flying back and forth; you'd need some kind of session identifier between the two. Let's make it 4 bytes; you probably won't have more than 4 million ongoing connections on a single computer.

You wouldn't even need a computer vs. pipe distinction. You want to connect to /web/com/yahoo/news/index. Your friendly neighborhood DNS servers would tell you that everything under /web/com/yahoo/news is listening at 74.6.143.25, so you pack up your query into a packet addressed that way, with a random session ID you'd expect the answer on. Then, you further pack this into an Ethernet frame, addressed at 12:34:56:78:9a:bc:de:ff, the gateway on your Ethernet (... which you do know via ARP requests... if you need these things; as per the article above, in the Perfect World of ipv6, you wouldn't even need mac addresses). It's all perfect layering.

(why this is actually good is coming up in one of the followup posts; I'm never getting to 100 if I keep writing long posts :))

This is post no. 13 for Kev Quirk's #100DaysToOffload challenge.

... comments welcome, either in email or on the (eventual) Mastodon post on Fosstodon.