As uncovered by e3ba0d6adde3 we are copying lots of irrelevant options
from the listener to an accepted socket, even those that aren't relevant
to a non-listener, e.g. SO_REUSE*, SO_ACCEPTFILTER. Stop doing that
and provide a fixed opt-in list for options to be inherited. Ideally
we shall not inherit anything at all. For compatibility inherit a set
of options that are meaningful for a non-listening socket of a protocol
that can listen(2).
Details
- Reviewers
markj tuexen rscheff - Group Reviewers
transport - Commits
- rGd29b95ecc0d0: sockets: on accept(2) don't copy all of so_options to new socket
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped - Build Status
Buildable 53037 Build 49928: arc lint + arc unit
Event Timeline
sys/kern/uipc_socket.c | ||
---|---|---|
765 | What about SO_DEBUG? Not that this is actually used right now, but I could envision a use case where I want to investigate all sockets related to a specific server and I would cover the period of time where it is still in the accept queue. |
sys/kern/uipc_socket.c | ||
---|---|---|
765 | I skipped it due to being unused. I wanted to make the list as small as possible. I can add it if there is a plan to ever reuse it. |
sys/kern/uipc_socket.c | ||
---|---|---|
765 | I think rscheff@ mentioned that he uses it for controlling adhoc debug code. I personally would prefer to either remove SO_DEBUG completely or have it inherited. Both look consistent to me. Having it, but not inheriting it look inconsistent to me. |
sys/kern/uipc_socket.c | ||
---|---|---|
765 | We are keeping it in /usr/include/sys/socket.h to avoid unnecessary compilation failures for historic applications. |
sys/kern/uipc_socket.c | ||
---|---|---|
762 | I think it would be great to document this. Maybe add a table to getsockopt(2) specifying for each SOL_SOCKET level socket option, whether it is inherited or not from a listener. Or to accept(2). However, getsockopt(2) already contains a list of SOL_SOCKET level socket options... |
sys/kern/uipc_socket.c | ||
---|---|---|
765 | Indeed I use it for ad-hoc debugging, since it has no side-effects (other than enabling my local debugging stuff). But I don't need inheritance of it generally, so I'm fine with the current list. |