HomeFreeBSD

inpcb: fix a panic with SO_REUSEPORT_LB + connect(2) misuse

Description

inpcb: fix a panic with SO_REUSEPORT_LB + connect(2) misuse

This combination doesn't make any sense. This socket option makes sense
only on a socket that is going to be a listening one. There are two
options here: refuse connect(2) on a socket that has the option set
previously, or ignore (and clear) the option. After some discussion on
phabricator, we have chosen the former, for safety and consistency
reasons. Any programmer that runs this sequence is doing something wrong
and should be informed of that with appropriate error code.

Since connect(2) is a SUS API that has a defined set of error codes, none
of which corresponds to "a socket has non-standard incompatible socket
option set", we decided to return the same error that an already listening
socket would return.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D49150

Details

Provenance
glebiusAuthored on Fri, Mar 7, 6:57 AM
Reviewer
markj
Differential Revision
D49150: inpcb: fix a panic with SO_REUSEPORT_LB + connect(2) misuse
Parents
rG2af953b132ee: inpcb: inline in_pcbconnect_setup() into in_pcbconnect()
Branches
Unknown
Tags
Unknown