Skip to content

Commit

Permalink
selftests: Fix the if conditions of in test_extra_filter()
Browse files Browse the repository at this point in the history
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 <wangyufen@huawei.com>
Link: https://lore.kernel.org/r/1663916557-10730-1-git-send-email-wangyufen@huawei.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
  • Loading branch information
wangyufen316 authored and Paolo Abeni committed Sep 27, 2022
1 parent ea64cdf commit bc7a319
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/testing/selftests/net/reuseport_bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ static void test_extra_filter(const struct test_params p)
if (bind(fd1, addr, sockaddr_size()))
error(1, errno, "failed to bind recv socket 1");

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

free(addr);
Expand Down

0 comments on commit bc7a319

Please sign in to comment.