opnsense-src/tests/sys/netinet
Mark Johnston a71853600c inpcb: Further restrict binding to a port owned by a different UID
See commit 4f02a7d739b3 for more background.

I cannot see a good reason to continue ignoring mismatching UIDs when
binding to INADDR_ANY.  Looking at the sdr.V2.4a7n sources (mentioned in
bugzilla PR 7713), there is a CANT_MCAST_BIND hack wherein the
application binds to INADDR_ANY instead of a multicast address, but
CANT_MCAST_BIND isn't defined for FreeBSD builds.

It seems unlikely that we still have a use-case for allowing sockets
from different UIDs to bind to the same port when binding to the
unspecified address.  And, as noted in D47832, applications like sdr
would have been broken by the inverted SO_REUSEPORT check removed in
that revision, apparently without any bug reports.  Let's break
compatibility and simply disallow this case outright.

Also, add some comments, remove a hack in a regression test which tests
this funtionality, and add a new regression test to exercise the
remaining checks that were added in commit 4658dc8325.

MFC after:	1 month
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D47870

(cherry picked from commit c9756953bded0d8428027fa3e812c9bdac069252)
2025-03-21 09:17:52 +01:00
..
libalias Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
arp.sh Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
carp.py netinet tests: test carp source MAC address 2023-04-07 17:56:45 +02:00
carp.sh carp: don't unintentionally revert to multicast mode 2025-01-24 11:54:30 +01: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_test.sh Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
forward.sh Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
ip6_v4mapped_test.c netinet tests: Add error handling tests for UDP with v4-mapped sockets 2023-10-24 09:19:46 -04:00
ip_reass_test.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
lpm.sh Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Makefile netinet tests: Make some tests more reliable when run in parallel 2024-10-17 13:45:45 +00: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-02-03 14:11:09 -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 Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
socket_afinet.c inpcb: Further restrict binding to a port owned by a different UID 2025-03-21 09:17:52 +01:00
tcp_connect_port_test.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06: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_dontroute.c Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00