How to bind to all addresses of only one network interface (Linux)?
问题 What I am trying to achieve is binding an IPv6 socket to any address of just one particular device , not system-wide. My intuition is that I could setsockopt() with SO_BINDTODEVICE followed by a bind to :: . It mostly does what I expect it to do. The behaviour is the same in v4. The sockets bound to an interface with SO_BINDTODEVICE will only accept connections made to addresses on that interface. That much is expected. However, I run into errno "Address already in use", if I'm trying to bind