* [PATCH v2] selftests/net: enable lo.accept_local in psock_snd test
@ 2022-05-25 3:18 Yun Lu
2022-05-25 7:20 ` Hangbin Liu
2022-05-26 5:10 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 4+ messages in thread
From: Yun Lu @ 2022-05-25 3:18 UTC (permalink / raw)
To: willemb, davem, edumazet
Cc: willemdebruijn.kernel, liuyun01, netdev, linux-kselftest
From: luyun <luyun@kylinos.cn>
The psock_snd test sends and recieves packets over loopback, and
the test results depend on parameter settings:
Set rp_filter=0,
or set rp_filter=1 and accept_local=1
so that the test will pass. Otherwise, this test will fail with
Resource temporarily unavailable:
sudo ./psock_snd.sh
dgram
tx: 128
rx: 142
./psock_snd: recv: Resource temporarily unavailable
For most distro kernel releases(like Ubuntu or Centos), the parameter
rp_filter is enabled by default, so it's necessary to enable the
parameter lo.accept_local in psock_snd test. And this test runs
inside a netns, changing a sysctl is fine.
v2: add detailed description.
Suggested-by: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Signed-off-by: luyun <luyun@kylinos.cn>
Reviewed-by: Jackie Liu <liuyun01@kylinos.cn>
---
tools/testing/selftests/net/psock_snd.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/net/psock_snd.c b/tools/testing/selftests/net/psock_snd.c
index 7d15e10a9fb6..edf1e6f80d41 100644
--- a/tools/testing/selftests/net/psock_snd.c
+++ b/tools/testing/selftests/net/psock_snd.c
@@ -389,6 +389,8 @@ int main(int argc, char **argv)
error(1, errno, "ip link set mtu");
if (system("ip addr add dev lo 172.17.0.1/24"))
error(1, errno, "ip addr add");
+ if (system("sysctl -w net.ipv4.conf.lo.accept_local=1"))
+ error(1, errno, "sysctl lo.accept_local");
run_test();
--
2.25.1
No virus found
Checked by Hillstone Network AntiVirus
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v2] selftests/net: enable lo.accept_local in psock_snd test
2022-05-25 3:18 [PATCH v2] selftests/net: enable lo.accept_local in psock_snd test Yun Lu
@ 2022-05-25 7:20 ` Hangbin Liu
2022-05-25 12:34 ` Willem de Bruijn
2022-05-26 5:10 ` patchwork-bot+netdevbpf
1 sibling, 1 reply; 4+ messages in thread
From: Hangbin Liu @ 2022-05-25 7:20 UTC (permalink / raw)
To: Yun Lu
Cc: willemb, davem, edumazet, willemdebruijn.kernel, liuyun01, netdev,
linux-kselftest
On Wed, May 25, 2022 at 11:18:19AM +0800, Yun Lu wrote:
> From: luyun <luyun@kylinos.cn>
>
> The psock_snd test sends and recieves packets over loopback, and
> the test results depend on parameter settings:
> Set rp_filter=0,
> or set rp_filter=1 and accept_local=1
> so that the test will pass. Otherwise, this test will fail with
> Resource temporarily unavailable:
> sudo ./psock_snd.sh
> dgram
> tx: 128
> rx: 142
> ./psock_snd: recv: Resource temporarily unavailable
>
> For most distro kernel releases(like Ubuntu or Centos), the parameter
> rp_filter is enabled by default, so it's necessary to enable the
> parameter lo.accept_local in psock_snd test. And this test runs
> inside a netns, changing a sysctl is fine.
>
> v2: add detailed description.
>
> Suggested-by: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
> Signed-off-by: luyun <luyun@kylinos.cn>
> Reviewed-by: Jackie Liu <liuyun01@kylinos.cn>
> ---
> tools/testing/selftests/net/psock_snd.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/testing/selftests/net/psock_snd.c b/tools/testing/selftests/net/psock_snd.c
> index 7d15e10a9fb6..edf1e6f80d41 100644
> --- a/tools/testing/selftests/net/psock_snd.c
> +++ b/tools/testing/selftests/net/psock_snd.c
> @@ -389,6 +389,8 @@ int main(int argc, char **argv)
> error(1, errno, "ip link set mtu");
> if (system("ip addr add dev lo 172.17.0.1/24"))
> error(1, errno, "ip addr add");
> + if (system("sysctl -w net.ipv4.conf.lo.accept_local=1"))
> + error(1, errno, "sysctl lo.accept_local");
>
> run_test();
>
> --
> 2.25.1
Great, this also fixed my problem. Please feel free to add my
Tested-by: Hangbin Liu <liuhangbin@gmail.com>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v2] selftests/net: enable lo.accept_local in psock_snd test
2022-05-25 7:20 ` Hangbin Liu
@ 2022-05-25 12:34 ` Willem de Bruijn
0 siblings, 0 replies; 4+ messages in thread
From: Willem de Bruijn @ 2022-05-25 12:34 UTC (permalink / raw)
To: Hangbin Liu
Cc: Yun Lu, davem, edumazet, willemdebruijn.kernel, liuyun01, netdev,
linux-kselftest
On Wed, May 25, 2022 at 3:20 AM Hangbin Liu <liuhangbin@gmail.com> wrote:
>
> On Wed, May 25, 2022 at 11:18:19AM +0800, Yun Lu wrote:
> > From: luyun <luyun@kylinos.cn>
> >
> > The psock_snd test sends and recieves packets over loopback, and
> > the test results depend on parameter settings:
> > Set rp_filter=0,
> > or set rp_filter=1 and accept_local=1
> > so that the test will pass. Otherwise, this test will fail with
> > Resource temporarily unavailable:
> > sudo ./psock_snd.sh
> > dgram
> > tx: 128
> > rx: 142
> > ./psock_snd: recv: Resource temporarily unavailable
> >
> > For most distro kernel releases(like Ubuntu or Centos), the parameter
> > rp_filter is enabled by default, so it's necessary to enable the
> > parameter lo.accept_local in psock_snd test. And this test runs
> > inside a netns, changing a sysctl is fine.
> >
> > v2: add detailed description.
> >
> > Suggested-by: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
> > Signed-off-by: luyun <luyun@kylinos.cn>
> > Reviewed-by: Jackie Liu <liuyun01@kylinos.cn>
Acked-by: Willem de Bruijn <willemb@google.com>
ps: I did not really suggest this fix, but no need to respin just to remove that
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] selftests/net: enable lo.accept_local in psock_snd test
2022-05-25 3:18 [PATCH v2] selftests/net: enable lo.accept_local in psock_snd test Yun Lu
2022-05-25 7:20 ` Hangbin Liu
@ 2022-05-26 5:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-05-26 5:10 UTC (permalink / raw)
To: Yun Lu
Cc: willemb, davem, edumazet, willemdebruijn.kernel, liuyun01, netdev,
linux-kselftest
Hello:
This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 25 May 2022 11:18:19 +0800 you wrote:
> From: luyun <luyun@kylinos.cn>
>
> The psock_snd test sends and recieves packets over loopback, and
> the test results depend on parameter settings:
> Set rp_filter=0,
> or set rp_filter=1 and accept_local=1
> so that the test will pass. Otherwise, this test will fail with
> Resource temporarily unavailable:
> sudo ./psock_snd.sh
> dgram
> tx: 128
> rx: 142
> ./psock_snd: recv: Resource temporarily unavailable
>
> [...]
Here is the summary with links:
- [v2] selftests/net: enable lo.accept_local in psock_snd test
https://git.kernel.org/netdev/net/c/215cd9897afb
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-05-26 5:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-25 3:18 [PATCH v2] selftests/net: enable lo.accept_local in psock_snd test Yun Lu
2022-05-25 7:20 ` Hangbin Liu
2022-05-25 12:34 ` Willem de Bruijn
2022-05-26 5:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox