diff mbox series

[net-next] selftests: Fix the if conditions of in test_extra_filter()

Message ID 1663850569-33122-1-git-send-email-wangyufen@huawei.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net-next] selftests: Fix the if conditions of in test_extra_filter() | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

wangyufen Sept. 22, 2022, 12:42 p.m. UTC
The socket 2 bind the addr in use, bind should fail with EADDRINUSE. So
if bind success or errno != EADDRINUSE, testcase should be failed.

Signed-off-by: Wang Yufen <wangyufen@huawei.com>
---
 tools/testing/selftests/net/reuseport_bpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jakub Kicinski Sept. 22, 2022, 1:12 p.m. UTC | #1
On Thu, 22 Sep 2022 20:42:49 +0800 Wang Yufen wrote:
> The socket 2 bind the addr in use, bind should fail with EADDRINUSE. So
> if bind success or errno != EADDRINUSE, testcase should be failed.

Please add a Fixes tag, even if the buggy commit has not reached Linus
yet.
wangyufen Sept. 23, 2022, 6:37 a.m. UTC | #2
在 2022/9/22 21:12, Jakub Kicinski 写道:
> On Thu, 22 Sep 2022 20:42:49 +0800 Wang Yufen wrote:
>> The socket 2 bind the addr in use, bind should fail with EADDRINUSE. So
>> if bind success or errno != EADDRINUSE, testcase should be failed.
> Please add a Fixes tag, even if the buggy commit has not reached Linus
> yet.

Thanks for your comment.  will add in v2
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/reuseport_bpf.c b/tools/testing/selftests/net/reuseport_bpf.c
index 072d709c..65aea27 100644
--- a/tools/testing/selftests/net/reuseport_bpf.c
+++ b/tools/testing/selftests/net/reuseport_bpf.c
@@ -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);