History log of /freebsd/tests/sys/netinet/so_reuseport_lb_test.c (Results 1 – 12 of 12)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# c7f803c7 07-Mar-2025 Gleb Smirnoff <glebius@FreeBSD.org>

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

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

show more ...


Revision tags: release/13.5.0
# 8b3d2c19 23-Feb-2025 Mark Johnston <markj@FreeBSD.org>

inpcb: Fix reuseport lbgroup array resizing

in_pcblisten() moves an inpcb from the per-group list into the array, at
which point it becomes visible to inpcb lookups in the datapath. It
assumes that

inpcb: Fix reuseport lbgroup array resizing

in_pcblisten() moves an inpcb from the per-group list into the array, at
which point it becomes visible to inpcb lookups in the datapath. It
assumes that there is space in the array for this, but that's not
guaranteed, since in_pcbinslbgrouphash() doesn't reserve space in the
array if the inpcb isn't associated with a listening socket.

We could resize the array in in_pcblisten(), but that would introduce a
failure case where there currently is none. Instead, keep track of the
number of pending inpcbs as well, and modify in_pcbinslbgrouphash() to
reserve space for each pending (i.e., not-yet-listening) inpcb.

Add a regression test.

Reviewed by: glebius
Reported by: netchild
Fixes: 7cbb6b6e28db ("inpcb: Close some SO_REUSEPORT_LB races, part 2")
Differential Revision: https://reviews.freebsd.org/D49100

show more ...


Revision tags: release/14.2.0-p2, release/14.1.0-p8, release/13.4.0-p4, release/14.1.0-p7, release/14.2.0-p1, release/13.4.0-p3
# 63efd7f5 27-Jan-2025 Mark Johnston <markj@FreeBSD.org>

socket tests: Add a test which calls listen() twice on an lb socket

This exercises commit 06bf119f265c ("sockets/tcp: quick fix for
regression with SO_REUSEPORT_LB")

Reviewed by: glebius
MFC after:

socket tests: Add a test which calls listen() twice on an lb socket

This exercises commit 06bf119f265c ("sockets/tcp: quick fix for
regression with SO_REUSEPORT_LB")

Reviewed by: glebius
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D48702

show more ...


# 7cbb6b6e 23-Jan-2025 Mark Johnston <markj@FreeBSD.org>

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

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

show more ...


Revision tags: release/14.2.0, release/13.4.0, release/14.1.0, release/13.3.0
# 6dced2c6 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

tests: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Rem

tests: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix

show more ...


Revision tags: release/14.0.0
# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


Revision tags: release/13.2.0, release/12.4.0, release/13.1.0, release/12.3.0, release/13.0.0, release/12.2.0
# 0d46edd0 25-Sep-2020 Olivier Cochard <olivier@FreeBSD.org>

Enable SO_LINGER to the so_reuseport_lb_test regression tests, preventing
many sockets in TIME_WAIT state at the end of the test.

PR: 249885
Reviewed by: markj
Approved by: markj
Sponsored by: Netf

Enable SO_LINGER to the so_reuseport_lb_test regression tests, preventing
many sockets in TIME_WAIT state at the end of the test.

PR: 249885
Reviewed by: markj
Approved by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26549

show more ...


Revision tags: release/11.4.0
# 6c9dbd8b 19-May-2020 Li-Wen Hsu <lwhsu@FreeBSD.org>

Revert r361237, it's fixed by r361231

PR: 246560
Sponsored by: The FreeBSD Foundation


# 3f5fe78b 19-May-2020 Li-Wen Hsu <lwhsu@FreeBSD.org>

Temporarily disable test case causes kernel panic in CI:

- sys.netinet.so_reuseport_lb_test.basic_ipv6

PR: 246560
Sponsored by: The FreeBSD Foundation


# 9b287735 25-Mar-2020 Alfredo Dal'Ava Junior <alfredo@FreeBSD.org>

so_reuseport_lb_test: correct setsockopt parameter size

Change type of variable used in setsocketopt so correct size of
option is passed.

Test failure was identified when running the test on PowerP

so_reuseport_lb_test: correct setsockopt parameter size

Change type of variable used in setsocketopt so correct size of
option is passed.

Test failure was identified when running the test on PowerPC64,
and the following error message was seen:

"bind () failed: Address already in use"

Submitted by: Fernando Valle <fernando.valle@eldorado.org.br>
Reviewed by: melifaro, adalava
Approved by: jhibbits (mentor)
Sponsored by: Eldorado Research Institute (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D24164

show more ...


Revision tags: release/12.1.0, release/11.3.0, release/12.0.0
# 3d5db455 24-Nov-2018 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r340427 through r340868.


# 634bb9e4 16-Nov-2018 Mark Johnston <markj@FreeBSD.org>

Rename the SO_REUSEPORT_LB test file to be consistent with other tests.

MFC after: 1 week