Thread (17 messages) 17 messages, 6 authors, 4d ago

Re: [PATCH bpf v2 4/4] selftests/bpf: Fail unbound UDP on sockmap update

From: Michal Luczaj <hidden>
Date: 2026-07-01 23:19:40
Also in: bpf, linux-kselftest, lkml

On 6/26/26 23:03, Kuniyuki Iwashima wrote:
On Fri, Jun 26, 2026 at 1:37 PM Michal Luczaj [off-list ref] wrote:
quoted
sockmap now rejects unbound UDP sockets. Adjust test_maps.

This effectively reverts commit c39aa2159974 ("bpf, selftests: Fix
test_maps now that sockmap supports UDP").

Signed-off-by: Michal Luczaj <redacted>
---
 tools/testing/selftests/bpf/test_maps.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c
index c32da7bd8be2..81cd5d0d69c1 100644
--- a/tools/testing/selftests/bpf/test_maps.c
+++ b/tools/testing/selftests/bpf/test_maps.c
@@ -759,12 +759,12 @@ static void test_sockmap(unsigned int tasks, void *data)
                goto out_sockmap;
        }

-       /* Test update with unsupported UDP socket */
+       /* Test update with unsupported unbound UDP socket */
        udp = socket(AF_INET, SOCK_DGRAM, 0);
        i = 0;
        err = bpf_map_update_elem(fd, &i, &udp, BPF_ANY);
-       if (err) {
-               printf("Failed socket update SOCK_DGRAM '%i:%i'\n",
+       if (!err) {
+               printf("Failed allowed unbound SOCK_DGRAM socket update '%i:%i'\n",
nit: Maybe s/Failed/Unexpectedly succeeded/ ?
Sure. I've tried to align with the other printfs ("failed allowed..."), but
I agree it was unclear.
If we want to avoid breakage, this patch needs to be squashed to
the fix patch, but it's discouraged in netdev, not sure about bpf tree.
I guess I'll just post v3 as is, and squash if requested.

thanks,
Michal
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help