Skip to content

Commit bc7a319

Browse files
wangyufen316Paolo Abeni
authored andcommitted
selftests: Fix the if conditions of in test_extra_filter()
The socket 2 bind the addr in use, bind should fail with EADDRINUSE. So if bind success or errno != EADDRINUSE, testcase should be failed. Fixes: 3ca8e40 ("soreuseport: BPF selection functional test") Signed-off-by: Wang Yufen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent ea64cdf commit bc7a319

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/testing/selftests/net/reuseport_bpf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ static void test_extra_filter(const struct test_params p)
328328
if (bind(fd1, addr, sockaddr_size()))
329329
error(1, errno, "failed to bind recv socket 1");
330330

331-
if (!bind(fd2, addr, sockaddr_size()) && errno != EADDRINUSE)
331+
if (!bind(fd2, addr, sockaddr_size()) || errno != EADDRINUSE)
332332
error(1, errno, "bind socket 2 should fail with EADDRINUSE");
333333

334334
free(addr);

0 commit comments

Comments
 (0)