All of lore.kernel.org
 help / color / mirror / Atom feed
* [net-next] selftests: Fix the if conditions of in test_extra_filter()
@ 2022-09-22 12:42 Wang Yufen
  2022-09-22 13:12 ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: Wang Yufen @ 2022-09-22 12:42 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, shuah
  Cc: netdev, linux-kselftest, linux-kernel, bpf

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(-)

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);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [net-next] selftests: Fix the if conditions of in test_extra_filter()
  2022-09-22 12:42 [net-next] selftests: Fix the if conditions of in test_extra_filter() Wang Yufen
@ 2022-09-22 13:12 ` Jakub Kicinski
  2022-09-23  6:37   ` wangyufen
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2022-09-22 13:12 UTC (permalink / raw)
  To: Wang Yufen
  Cc: davem, edumazet, pabeni, shuah, netdev, linux-kselftest,
	linux-kernel, bpf

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [net-next] selftests: Fix the if conditions of in test_extra_filter()
  2022-09-22 13:12 ` Jakub Kicinski
@ 2022-09-23  6:37   ` wangyufen
  0 siblings, 0 replies; 3+ messages in thread
From: wangyufen @ 2022-09-23  6:37 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, edumazet, pabeni, shuah, netdev, linux-kselftest,
	linux-kernel, bpf


在 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-23  6:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-22 12:42 [net-next] selftests: Fix the if conditions of in test_extra_filter() Wang Yufen
2022-09-22 13:12 ` Jakub Kicinski
2022-09-23  6:37   ` wangyufen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.