BPF List
 help / color / mirror / Atom feed
* [PATCH v1 net-next 2/4] selftests: bpf: sockmap: Remove AF_UNIX MSG_OOB test case.
       [not found] <20261116021845.2533130-1-kuniyu@google.com>
@ 2026-11-16  2:18 ` Kuniyuki Iwashima
  2026-11-18  2:23   ` Jiayuan Chen
  0 siblings, 1 reply; 2+ messages in thread
From: Kuniyuki Iwashima @ 2026-11-16  2:18 UTC (permalink / raw)
  To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, Kuniyuki Iwashima, Kuniyuki Iwashima, netdev,
	John Fastabend, Jakub Sitnicki, Jiayuan Chen, bpf

We will drop MSG_OOB support from AF_UNIX.

Let's remove the test case from sockmap_redir.

Note that struct socket_spec.send_flags is no longer used so
removed too.

Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
---
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: Jakub Sitnicki <jakub@cloudflare.com>
Cc: Jiayuan Chen <jiayuan.chen@linux.dev>
Cc: bpf@vger.kernel.org
---
 .../selftests/bpf/prog_tests/sockmap_redir.c  | 45 +++++--------------
 1 file changed, 11 insertions(+), 34 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_redir.c b/tools/testing/selftests/bpf/prog_tests/sockmap_redir.c
index 9c461d93113d..e73d3a674a74 100644
--- a/tools/testing/selftests/bpf/prog_tests/sockmap_redir.c
+++ b/tools/testing/selftests/bpf/prog_tests/sockmap_redir.c
@@ -103,7 +103,6 @@ struct redir_spec {
 struct socket_spec {
 	int family;
 	int sotype;
-	int send_flags;
 	int in[2];
 	int out[2];
 };
@@ -197,12 +196,12 @@ static void handle_unsupported(int sd_send, int sd_peer, int sd_in, int sd_out,
 		try_recv("bpf.recv(sd_recv)", sd_recv, MSG_DONTWAIT, false);
 }
 
-static void test_send_redir_recv(int sd_send, int send_flags, int sd_peer,
+static void test_send_redir_recv(int sd_send, int sd_peer,
 				 int sd_in, int sd_out, int sd_recv,
 				 struct maps *maps, int status)
 {
 	unsigned int drop, pass;
-	char *send_buf = "ab";
+	char *send_buf = "a";
 	char recv_buf = '\0';
 	ssize_t n, len = 1;
 
@@ -217,10 +216,7 @@ static void test_send_redir_recv(int sd_send, int send_flags, int sd_peer,
 	if (xbpf_map_update_elem(maps->out, &u32(0), &u64(sd_out), BPF_NOEXIST))
 		goto del_in;
 
-	/* Last byte is OOB data when send_flags has MSG_OOB bit set */
-	if (send_flags & MSG_OOB)
-		len++;
-	n = send(sd_send, send_buf, len, send_flags);
+	n = send(sd_send, send_buf, len, 0);
 	if (n >= 0 && n < len)
 		FAIL("incomplete send");
 	if (n < 0) {
@@ -255,20 +251,6 @@ static void test_send_redir_recv(int sd_send, int send_flags, int sd_peer,
 	if (recv_buf != send_buf[0])
 		FAIL("recv(): payload check, %02x != %02x", recv_buf, send_buf[0]);
 
-	if (send_flags & MSG_OOB) {
-		/* Fail reading OOB while in sockmap */
-		try_recv("bpf.recv(sd_out, MSG_OOB)", sd_out,
-			 MSG_OOB | MSG_DONTWAIT, false);
-
-		/* Remove sd_out from sockmap */
-		xbpf_map_delete_elem(maps->out, &u32(0));
-
-		/* Check that OOB was dropped on redirect */
-		try_recv("recv(sd_out, MSG_OOB)", sd_out,
-			 MSG_OOB | MSG_DONTWAIT, false);
-
-		goto del_in;
-	}
 out:
 	xbpf_map_delete_elem(maps->out, &u32(0));
 del_in:
@@ -328,7 +310,7 @@ static void test_socket(enum bpf_map_type type, struct redir_spec *redir,
 			struct maps *maps, struct socket_spec *s_in,
 			struct socket_spec *s_out)
 {
-	int fd_in, fd_out, fd_send, fd_peer, fd_recv, flags, status;
+	int fd_in, fd_out, fd_send, fd_peer, fd_recv, status;
 	const char *in_str, *out_str;
 	char s[MAX_TEST_NAME];
 
@@ -337,26 +319,24 @@ static void test_socket(enum bpf_map_type type, struct redir_spec *redir,
 	fd_send = s_in->in[redir->idx_send];
 	fd_peer = s_in->in[redir->idx_send ^ 1];
 	fd_recv = s_out->out[redir->idx_recv];
-	flags = s_in->send_flags;
 
 	in_str = socket_kind_to_str(fd_in);
 	out_str = socket_kind_to_str(fd_out);
 	status = get_support_status(redir->prog_type, in_str, out_str);
 
 	snprintf(s, sizeof(s),
-		 "%-4s %-17s %-5s %s %-5s%6s",
-		 /* hash sk_skb-to-ingress u_str → v_str (OOB) */
+		 "%-4s %-17s %-5s %s %-5s",
+		 /* hash sk_skb-to-ingress u_str → v_str */
 		 type == BPF_MAP_TYPE_SOCKMAP ? "map" : "hash",
 		 redir->name,
 		 in_str,
 		 status & SUPPORTED ? "→" : " ",
-		 out_str,
-		 (flags & MSG_OOB) ? "(OOB)" : "");
+		 out_str);
 
 	if (!test__start_subtest(s))
 		return;
 
-	test_send_redir_recv(fd_send, flags, fd_peer, fd_in, fd_out, fd_recv,
+	test_send_redir_recv(fd_send, fd_peer, fd_in, fd_out, fd_recv,
 			     maps, status);
 }
 
@@ -365,12 +345,10 @@ static void test_redir(enum bpf_map_type type, struct redir_spec *redir,
 {
 	struct socket_spec *s, sockets[] = {
 		{ AF_INET, SOCK_STREAM },
-		// { AF_INET, SOCK_STREAM, MSG_OOB }, /* Known to be broken */
 		{ AF_INET6, SOCK_STREAM },
 		{ AF_INET, SOCK_DGRAM },
 		{ AF_INET6, SOCK_DGRAM },
 		{ AF_UNIX, SOCK_STREAM },
-		{ AF_UNIX, SOCK_STREAM, MSG_OOB },
 		{ AF_UNIX, SOCK_DGRAM },
 		// { AF_UNIX, SOCK_SEQPACKET},	/* Unsupported BPF_MAP_UPDATE_ELEM */
 		{ AF_VSOCK, SOCK_STREAM },
@@ -392,10 +370,9 @@ static void test_redir(enum bpf_map_type type, struct redir_spec *redir,
 			struct socket_spec *out = &sockets[j];
 			struct socket_spec *in = &sockets[i];
 
-			/* Skip intra-proto and between variants */
-			if (out->send_flags ||
-			    (in->family == out->family &&
-			     in->sotype == out->sotype))
+			/* Skip intra-proto */
+			if (in->family == out->family &&
+			    in->sotype == out->sotype)
 				continue;
 
 			test_socket(type, redir, maps, in, out);
-- 
2.56.0.611.g1030f0b940-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1 net-next 2/4] selftests: bpf: sockmap: Remove AF_UNIX MSG_OOB test case.
  2026-11-16  2:18 ` [PATCH v1 net-next 2/4] selftests: bpf: sockmap: Remove AF_UNIX MSG_OOB test case Kuniyuki Iwashima
@ 2026-11-18  2:23   ` Jiayuan Chen
  0 siblings, 0 replies; 2+ messages in thread
From: Jiayuan Chen @ 2026-11-18  2:23 UTC (permalink / raw)
  To: Kuniyuki Iwashima, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni
  Cc: Simon Horman, Kuniyuki Iwashima, netdev, John Fastabend,
	Jakub Sitnicki, Jiayuan Chen, bpf


On 11/16/26 10:18 AM, Kuniyuki Iwashima wrote:
> We will drop MSG_OOB support from AF_UNIX.
>
> Let's remove the test case from sockmap_redir.
>
> Note that struct socket_spec.send_flags is no longer used so
> removed too.
>
> Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>



Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>


> ---
> Cc: John Fastabend <john.fastabend@gmail.com>
> Cc: Jakub Sitnicki <jakub@cloudflare.com>
> Cc: Jiayuan Chen <jiayuan.chen@linux.dev>
> Cc: bpf@vger.kernel.org
> ---
>  .../selftests/bpf/prog_tests/sockmap_redir.c  | 45 +++++--------------
>  1 file changed, 11 insertions(+), 34 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_redir.c b/tools/testing/selftests/bpf/prog_tests/sockmap_redir.c
> index 9c461d93113d..e73d3a674a74 100644
> --- a/tools/testing/selftests/bpf/prog_tests/sockmap_redir.c
> +++ b/tools/testing/selftests/bpf/prog_tests/sockmap_redir.c
> @@ -103,7 +103,6 @@ struct redir_spec {
>  struct socket_spec {
>  	int family;
>  	int sotype;
> -	int send_flags;
>  	int in[2];
>  	int out[2];
>  };
> @@ -197,12 +196,12 @@ static void handle_unsupported(int sd_send, int sd_peer, int sd_in, int sd_out,
>  		try_recv("bpf.recv(sd_recv)", sd_recv, MSG_DONTWAIT, false);
>  }
>  
> -static void test_send_redir_recv(int sd_send, int send_flags, int sd_peer,
> +static void test_send_redir_recv(int sd_send, int sd_peer,
>  				 int sd_in, int sd_out, int sd_recv,
>  				 struct maps *maps, int status)
>  {
>  	unsigned int drop, pass;
> -	char *send_buf = "ab";
> +	char *send_buf = "a";
>  	char recv_buf = '\0';
>  	ssize_t n, len = 1;
>  
> @@ -217,10 +216,7 @@ static void test_send_redir_recv(int sd_send, int send_flags, int sd_peer,
>  	if (xbpf_map_update_elem(maps->out, &u32(0), &u64(sd_out), BPF_NOEXIST))
>  		goto del_in;
>  
> -	/* Last byte is OOB data when send_flags has MSG_OOB bit set */
> -	if (send_flags & MSG_OOB)
> -		len++;
> -	n = send(sd_send, send_buf, len, send_flags);
> +	n = send(sd_send, send_buf, len, 0);
>  	if (n >= 0 && n < len)
>  		FAIL("incomplete send");
>  	if (n < 0) {
> @@ -255,20 +251,6 @@ static void test_send_redir_recv(int sd_send, int send_flags, int sd_peer,
>  	if (recv_buf != send_buf[0])
>  		FAIL("recv(): payload check, %02x != %02x", recv_buf, send_buf[0]);
>  
> -	if (send_flags & MSG_OOB) {
> -		/* Fail reading OOB while in sockmap */
> -		try_recv("bpf.recv(sd_out, MSG_OOB)", sd_out,
> -			 MSG_OOB | MSG_DONTWAIT, false);
> -
> -		/* Remove sd_out from sockmap */
> -		xbpf_map_delete_elem(maps->out, &u32(0));
> -
> -		/* Check that OOB was dropped on redirect */
> -		try_recv("recv(sd_out, MSG_OOB)", sd_out,
> -			 MSG_OOB | MSG_DONTWAIT, false);
> -
> -		goto del_in;
> -	}
>  out:
>  	xbpf_map_delete_elem(maps->out, &u32(0));
>  del_in:
> @@ -328,7 +310,7 @@ static void test_socket(enum bpf_map_type type, struct redir_spec *redir,
>  			struct maps *maps, struct socket_spec *s_in,
>  			struct socket_spec *s_out)
>  {
> -	int fd_in, fd_out, fd_send, fd_peer, fd_recv, flags, status;
> +	int fd_in, fd_out, fd_send, fd_peer, fd_recv, status;
>  	const char *in_str, *out_str;
>  	char s[MAX_TEST_NAME];
>  
> @@ -337,26 +319,24 @@ static void test_socket(enum bpf_map_type type, struct redir_spec *redir,
>  	fd_send = s_in->in[redir->idx_send];
>  	fd_peer = s_in->in[redir->idx_send ^ 1];
>  	fd_recv = s_out->out[redir->idx_recv];
> -	flags = s_in->send_flags;
>  
>  	in_str = socket_kind_to_str(fd_in);
>  	out_str = socket_kind_to_str(fd_out);
>  	status = get_support_status(redir->prog_type, in_str, out_str);
>  
>  	snprintf(s, sizeof(s),
> -		 "%-4s %-17s %-5s %s %-5s%6s",
> -		 /* hash sk_skb-to-ingress u_str → v_str (OOB) */
> +		 "%-4s %-17s %-5s %s %-5s",
> +		 /* hash sk_skb-to-ingress u_str → v_str */
>  		 type == BPF_MAP_TYPE_SOCKMAP ? "map" : "hash",
>  		 redir->name,
>  		 in_str,
>  		 status & SUPPORTED ? "→" : " ",
> -		 out_str,
> -		 (flags & MSG_OOB) ? "(OOB)" : "");
> +		 out_str);
>  
>  	if (!test__start_subtest(s))
>  		return;
>  
> -	test_send_redir_recv(fd_send, flags, fd_peer, fd_in, fd_out, fd_recv,
> +	test_send_redir_recv(fd_send, fd_peer, fd_in, fd_out, fd_recv,
>  			     maps, status);
>  }
>  
> @@ -365,12 +345,10 @@ static void test_redir(enum bpf_map_type type, struct redir_spec *redir,
>  {
>  	struct socket_spec *s, sockets[] = {
>  		{ AF_INET, SOCK_STREAM },
> -		// { AF_INET, SOCK_STREAM, MSG_OOB }, /* Known to be broken */
>  		{ AF_INET6, SOCK_STREAM },
>  		{ AF_INET, SOCK_DGRAM },
>  		{ AF_INET6, SOCK_DGRAM },
>  		{ AF_UNIX, SOCK_STREAM },
> -		{ AF_UNIX, SOCK_STREAM, MSG_OOB },
>  		{ AF_UNIX, SOCK_DGRAM },
>  		// { AF_UNIX, SOCK_SEQPACKET},	/* Unsupported BPF_MAP_UPDATE_ELEM */
>  		{ AF_VSOCK, SOCK_STREAM },
> @@ -392,10 +370,9 @@ static void test_redir(enum bpf_map_type type, struct redir_spec *redir,
>  			struct socket_spec *out = &sockets[j];
>  			struct socket_spec *in = &sockets[i];
>  
> -			/* Skip intra-proto and between variants */
> -			if (out->send_flags ||
> -			    (in->family == out->family &&
> -			     in->sotype == out->sotype))
> +			/* Skip intra-proto */
> +			if (in->family == out->family &&
> +			    in->sotype == out->sotype)
>  				continue;
>  
>  			test_socket(type, redir, maps, in, out);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-18  2:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20261116021845.2533130-1-kuniyu@google.com>
2026-11-16  2:18 ` [PATCH v1 net-next 2/4] selftests: bpf: sockmap: Remove AF_UNIX MSG_OOB test case Kuniyuki Iwashima
2026-11-18  2:23   ` Jiayuan Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox