News for hackers. Stuff that matters.
Re:Why IPv6 is the only way forward by Chu4eeno on Tuesday April 07, 2026 @04:08PM (#47680710)
... and annoying casting from `sockaddr` to either `sockaddr_in` or `sockaddr_in6*` while you pass around a socklen_t.

10 years ago I was all gung-ho about IPv6, but it's annoying at every level.

Re:Why IPv6 is the only way forward by tonymet on Tuesday April 07, 2026 @04:22PM (#47680871)
Having 2 sockets for loopback or multiple interfaces is a huge pain
Re:Why IPv6 is the only way forward by BenjiWiebe on Wednesday April 08, 2026 @12:10AM (#47685115)
Bind to '::' and you can get v4 and v6 traffic on one socket.
Re:Why IPv6 is the only way forward by tonymet on Wednesday April 08, 2026 @12:50AM (#47685405)
Doesn’t work for loopback (you have to listen externally )
Re:Why IPv6 is the only way forward by vimredo on Wednesday April 08, 2026 @01:10AM (#47685557)
It works fine for me on NixOS (Linux), with a recent kernel version and no weird config options - or at least I think so.
Re:Why IPv6 is the only way forward by IcePic on Wednesday April 08, 2026 @04:35AM (#47687127)
Not on all OSes. And it's not all good to have one less socket, there are still issues with people not expecting v4 traffic on a v6-capable socket, like described here:

https://radar.offseq.com/threat/ipv4-mapped-ipv6-addresses-t...

If you want to handle two protocols, it is not unreasonable to use two sockets.

Re:Why IPv6 is the only way forward by Dagger2 on Wednesday April 08, 2026 @05:15AM (#47687490)
Why are you casting to sockaddr_in/6? The whole point of that system is that you can just pass around the sockaddr* without even needing to have a definition for sockaddr_in or sockaddr_in6. All of the socket API functions accept sockaddr*, and if you need to get the IP or port out then you use getnameinfo(), which also takes sockaddr*. There should be little reason to ever cast to either of those types in normal use. (I can think of one or two cases where you might, but they're not common.)

Having to deal with the separate socklen_t is mildly annoying, but you can just make a little struct that holds both.