opnsense-src/tests/sys/netinet
Mark Johnston c9756953bd inpcb: Further restrict binding to a port owned by a different UID
See commit 4f02a7d739 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
2024-12-23 15:41:06 +00:00
..
libalias libalias: Add support for EIM NAT 2024-12-05 16:19:13 +00:00
arp.sh tests/arp: test arp -s/-S work 2024-02-20 10:32:03 -08:00
carp.py netinet tests: basic VRRP tests 2024-05-08 13:19:04 +02:00
carp.sh vnet tests: check for if_bridge.ko 2024-06-04 22:16:56 +02: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 netinet: handle blackhole routes 2024-11-20 16:52:41 +01:00
igmp.py netinet tests: test that we send IGMP join/leave packets as expected 2023-12-19 17:47:41 +01: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: remove reference to renamed test 2024-12-18 10:38:10 -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 tests: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:01 -07: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_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