This proposes extending SocketAddress to allow us to specify the network namespace. The primary use-case I have in mind is one where we'd have listeners that listen in different network namespaces than the one that the worker threads belong to.
This would not change any existing behavior if the field is unset.
The API changes I have in mind can be found in this draft PR:
#38945
This should not require a change to the threading model, as #29675 suggests. The way we do this should be something like:
- Spawn a new thread and change its namespace via setns().
- Pass the socket fd back to the primary thread.
- You now have a socket in another netns that you can accept connections on.
For sockets that specify another netns, this makes initial socket creation a syscall-heavy operation, but for the use-case above I believe it should only occur during listener instantiation.
Relevant Links:
This proposes extending SocketAddress to allow us to specify the network namespace. The primary use-case I have in mind is one where we'd have listeners that listen in different network namespaces than the one that the worker threads belong to.
This would not change any existing behavior if the field is unset.
The API changes I have in mind can be found in this draft PR:
#38945
This should not require a change to the threading model, as #29675 suggests. The way we do this should be something like:
For sockets that specify another netns, this makes initial socket creation a syscall-heavy operation, but for the use-case above I believe it should only occur during listener instantiation.
Relevant Links: