git: 618dc484b581 - main - tests/netinet/socket_afinet: add more tests to multibind

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Mon, 10 Aug 2026 20:51:08 UTC
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=618dc484b5817b7a7560632410c9ca5c32c85a84

commit 618dc484b5817b7a7560632410c9ca5c32c85a84
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2026-08-10 20:44:28 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2026-08-10 20:50:22 +0000

    tests/netinet/socket_afinet: add more tests to multibind
    
    Add tests where first socket and second socket are bound to different
    addresses, e.g. first specific and second wildcard and vice versa.
    
    Mark success with SO_REUSEPORT on the second socket as a bug suspect.
    
    Mark failure to bind to INADDR_ANY in presence of other UID's specific
    bound socket to the same port as probably too strict.
    
    Differential Revision:  https://reviews.freebsd.org/D58088
---
 tests/sys/netinet/socket_afinet.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tests/sys/netinet/socket_afinet.c b/tests/sys/netinet/socket_afinet.c
index d0c09be18a7c..4d82108f1822 100644
--- a/tests/sys/netinet/socket_afinet.c
+++ b/tests/sys/netinet/socket_afinet.c
@@ -462,6 +462,12 @@ ATF_TC_BODY(multibind, tc)
 		{ SOCK_STREAM,   LB, x, ADDR, x, F, F },
 		{ SOCK_STREAM,   LB, x, PORT, x, F, F },
 		{ SOCK_STREAM,   LB, x,   LB, x, R, F },
+		{ SOCK_STREAM,    0, x,    0, o, F, F },
+		{ SOCK_STREAM,    0, x, ADDR, o, R, F },
+		{ SOCK_STREAM,    0, x, PORT, o, R, F }, /* bug? */
+		{ SOCK_STREAM,    0, o,    0, x, F, F },
+		{ SOCK_STREAM,    0, o, ADDR, x, R, F }, /* too strict? */
+		{ SOCK_STREAM,    0, o, PORT, x, R, F }, /* bug? */
 		/*
 		 * ATM, expected result for SOCK_DGRAM is the same as for
 		 * SOCK_STREAM.  Thus the below is copy-and-paste of the above.
@@ -498,6 +504,12 @@ ATF_TC_BODY(multibind, tc)
 		{ SOCK_DGRAM,   LB, x, ADDR, x, F, F },
 		{ SOCK_DGRAM,   LB, x, PORT, x, F, F },
 		{ SOCK_DGRAM,   LB, x,   LB, x, R, F },
+		{ SOCK_DGRAM,    0, x,    0, o, F, F },
+		{ SOCK_DGRAM,    0, x, ADDR, o, R, F },
+		{ SOCK_DGRAM,    0, x, PORT, o, R, F }, /* bug? */
+		{ SOCK_DGRAM,    0, o,    0, x, F, F },
+		{ SOCK_DGRAM,    0, o, ADDR, x, R, F }, /* too strict? */
+		{ SOCK_DGRAM,    0, o, PORT, x, R, F }, /* bug? */
 #undef F
 #undef R
 #undef x