Skip to content

Commit dcf4272

Browse files
wangyufen316gregkh
authored andcommitted
selftests: Fix the if conditions of in test_extra_filter()
[ Upstream commit bc7a319 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 929a2f6 commit dcf4272

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)