opnsense-src/tests/sys/netinet
Mark Johnston 8b3d2c19d3 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:		7cbb6b6e28 ("inpcb: Close some SO_REUSEPORT_LB races, part 2")
Differential Revision:	https://reviews.freebsd.org/D49100
2025-02-23 16:20:12 +00:00
..
libalias libalias: Add support for EIM NAT 2024-12-05 16:19:13 +00:00
arp.sh netinet tests: basic garp test 2025-01-20 14:28:39 +01:00
broadcast.c tests/netinet: add few tests for sending a broadcast packet 2025-02-21 18:11:12 -08:00
carp.py sys tests: Add scapy as a required program 2025-02-12 14:40:43 +00:00
carp.sh tests: carp: Update test case unicast_v4 to catch PR 284872 2025-02-23 03:26:32 +08:00
divert.sh Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
fibs.sh Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
fibs_multibind_test.c fibs_multibind_test: Explicitly cast the checksum value 2025-02-08 16:05:37 +00:00
fibs_test.sh netstat: restore printing the "default" keyword, provide -nn option 2025-02-03 10:09:58 -08:00
forward.sh netinet: handle blackhole routes 2024-11-20 16:52:41 +01:00
igmp.py sys tests: Add scapy as a required program 2025-02-12 14:40:43 +00:00
ip6_v4mapped_test.c tests: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:01 -07:00
ip_reass_test.c tests: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:01 -07:00
lpm.sh Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Makefile tests/netinet: add few tests for sending a broadcast packet 2025-02-21 18:11:12 -08:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
output.sh netinet tests: Make test jail names unique 2024-01-27 13:51:37 -05:00
redirect.py Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
redirect.sh Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
so_reuseport_lb_test.c inpcb: Fix reuseport lbgroup array resizing 2025-02-23 16:20:12 +00:00
socket_afinet.c inpcb: Further restrict binding to a port owned by a different UID 2024-12-23 15:41:06 +00:00
tcp_connect_port_test.c tests: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:01 -07:00
tcp_implied_connect.c tests/netinet: push variable 'sin' into function scope 2024-02-02 21:09:02 -08:00
tcp_md5_getsockopt.c Add tests for TCP_MD5 getsockopt 2022-06-23 15:57:56 +01:00
tcp_user_cookie.c Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00
udp_bindings.c tests/netinet: add few tests for unconnected UDP socket 2025-02-17 15:28:51 -08:00
udp_dontroute.c Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00
udp_io.c tests/netinet: fix UDP I/O test build 2024-03-23 09:21:13 -07:00