Skip to contentSkip to conversation

selftests: Fix the if conditions of in test_extra_filter()

PATCH Applied Wang Yufen 2 participants 2 messages Sep 23, 2022 – Sep 27, 2022

Subsystems (4)
lore
Share & tools
lore

Wang Yufen

author
#0 lore raw

PATCH v2 1/1 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 3ca8e4029969 ("soreuseport: BPF selection functional test")

---
v1 -> v2: add a Fixes tag

 tools/testing/selftests/net/reuseport_bpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/reuseport_bpf.c +1 -1
index 072d709c..65aea27 100644
@@ -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);
Signature · 1 line
1.8.3.1
#1 lore raw
This patch was applied to netdev/net.git (master) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by Paolo Abeni <[email protected]>:

Quoted 9 lines · On Fri, 23 Sep 2022 15:02:37 +0800 you 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.

Fixes 3ca8e4029969 ("soreuseport: BPF selection functional test")

---
v1 -> v2: add a Fixes tag

 tools/testing/selftests/net/reuseport_bpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
- [net-next,v2] selftests: Fix the if conditions of in test_extra_filter()

    https://git.kernel.org/netdev/net/c/bc7a31984489

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html