From: luyun Date: Wed, 25 May 2022 03:18:19 +0000 (+0800) Subject: selftests/net: enable lo.accept_local in psock_snd test X-Git-Tag: baikal/aarch64/sdk6.1~3836^2~50 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=96acec454d06552c3f016c550a556e78ac6abad7;p=kernel.git selftests/net: enable lo.accept_local in psock_snd test The psock_snd test sends and receives 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. Signed-off-by: luyun Reviewed-by: Jackie Liu Tested-by: Hangbin Liu Acked-by: Willem de Bruijn Link: https://lore.kernel.org/r/20220525031819.866684-1-luyun_611@163.com Signed-off-by: Jakub Kicinski --- diff --git a/tools/testing/selftests/net/psock_snd.c b/tools/testing/selftests/net/psock_snd.c index 7d15e10a9fb6a..edf1e6f80d414 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();