diff options
author | Wang Yufen <wangyufen@huawei.com> | 2022-09-23 15:02:37 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-10-05 10:39:43 +0200 |
commit | 4755d9d2c9b08f975b9b0a794deebb17412f2be0 (patch) | |
tree | 02fbaba287787260bfd71431f1280838379be466 | |
parent | c83a7606aa6592badb737a034a4522ec9ce40b28 (diff) | |
download | linux-stable-4755d9d2c9b08f975b9b0a794deebb17412f2be0.tar.gz linux-stable-4755d9d2c9b08f975b9b0a794deebb17412f2be0.tar.bz2 linux-stable-4755d9d2c9b08f975b9b0a794deebb17412f2be0.zip |
selftests: Fix the if conditions of in test_extra_filter()
[ Upstream commit bc7a319844891746135dc1f34ab9df78d636a3ac ]
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")
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>
-rw-r--r-- | tools/testing/selftests/net/reuseport_bpf.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/net/reuseport_bpf.c b/tools/testing/selftests/net/reuseport_bpf.c index b5277106df1f..b0cc082fbb84 100644 --- a/tools/testing/selftests/net/reuseport_bpf.c +++ b/tools/testing/selftests/net/reuseport_bpf.c @@ -330,7 +330,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); |