aboutsummaryrefslogtreecommitdiff
path: root/crypto/openssl/demos/bio
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2025-01-23 17:00:11 +0000
committerMark Johnston <markj@FreeBSD.org>2025-01-23 17:12:10 +0000
commit7cbb6b6e28db33095a1cf7a8887921a5ec969824 (patch)
tree0b04e044b12e01c396af1451de2b131af7fea566 /crypto/openssl/demos/bio
parent18c47eab727c6ac6505cca981175b2a7a6e9630b (diff)
inpcb: Close some SO_REUSEPORT_LB races, part 2
Suppose a thread is adds a socket to an existing TCP lbgroup that is actively accepting connections. It has to do the following operations: 1. set SO_REUSEPORT_LB on the socket 2. bind() the socket to the shared address/port 3. call listen() Step 2 makes the inpcb visible to incoming connection requests. However, at this point the inpcb cannot accept new connections. If in_pcblookup() matches it, the remote end will see ECONNREFUSED even when other listening sockets are present in the lbgroup. This means that dynamically adding inpcbs to an lbgroup (e.g., by starting up new workers) can trigger spurious connection failures for no good reason. (A similar problem exists when removing inpcbs from an lbgroup, but that is harder to fix and is not addressed by this patch; see the review for a bit more commentary.) Fix this by augmenting each lbgroup with a linked list of inpcbs that are pending a listen() call. When adding an inpcb to an lbgroup, keep the inpcb on this list if listen() hasn't been called, so it is not yet visible to the lookup path. Then, add a new in_pcblisten() routine which makes the inpcb visible within the lbgroup now that it's safe to let it handle new connections. Add a regression test which verifies that we don't get spurious connection errors while adding sockets to an LB group. Reviewed by: glebius MFC after: 1 month Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D48544
Diffstat (limited to 'crypto/openssl/demos/bio')
0 files changed, 0 insertions, 0 deletions