]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
kern: sonewconn: set so_options before pru_attach()
authorKyle Evans <kevans@FreeBSD.org>
Wed, 20 Jan 2021 17:53:05 +0000 (11:53 -0600)
committerKyle Evans <kevans@FreeBSD.org>
Tue, 9 Feb 2021 03:44:43 +0000 (21:44 -0600)
commit504ebd612ec61165bb949cfce3a348b0d6f37008
treedb459b79edfac6b6afd9da266725bb29efb04929
parent3bc17248d31794519ba95b2c6b9ff8a0d31dba81
kern: sonewconn: set so_options before pru_attach()

Protocol attachment has historically been able to observe and modify
so->so_options as needed, and it still can for newly created sockets.
779f106aa169 moved this to after pru_attach() when we re-acquire the
lock on the listening socket.

Restore the historical behavior so that pru_attach implementations can
consistently use it. Note that some pru_attach() do currently rely on
this, though that may change in the future. D28265 contains a change to
remove the use in TCP and IB/SDP bits, as resetting the requested linger
time on incoming connections seems questionable at best.

This does move the assignment out from under the head's listen lock, but
glebius notes that head won't be going away and applications cannot
assume any specific ordering with a race between a connection coming in
and the application changing socket options anyways.

Discussed-with: glebius
MFC-after: 1 week
sys/kern/uipc_socket.c