diff options
author | Guillaume Nault <gnault@redhat.com> | 2023-05-11 16:39:39 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-05-12 10:43:56 +0200 |
commit | a431327c4faacf978defa94dd0da1710d0c69801 (patch) | |
tree | e8490ca985559f32bbf71f06c2e2c1014024b5a3 | |
parent | selftests: fcnal: Test SO_DONTROUTE on TCP sockets. (diff) | |
download | linux-a431327c4faacf978defa94dd0da1710d0c69801.tar.xz linux-a431327c4faacf978defa94dd0da1710d0c69801.zip |
selftests: fcnal: Test SO_DONTROUTE on UDP sockets.
Use nettest --client-dontroute to test the kernel behaviour with UDP
sockets having the SO_DONTROUTE option. Sending packets to a neighbour
(on link) host, should work. When the host is behind a router, sending
should fail.
Signed-off-by: Guillaume Nault <gnault@redhat.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rwxr-xr-x | tools/testing/selftests/net/fcnal-test.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/testing/selftests/net/fcnal-test.sh b/tools/testing/selftests/net/fcnal-test.sh index 3a1f3051321f..08b4b96cbd63 100755 --- a/tools/testing/selftests/net/fcnal-test.sh +++ b/tools/testing/selftests/net/fcnal-test.sh @@ -1641,6 +1641,23 @@ ipv4_udp_novrf() log_start run_cmd nettest -D -d ${NSA_DEV} -r ${a} log_test_addr ${a} $? 2 "No server, device client, local conn" + + # + # Link local connection tests (SO_DONTROUTE). + # Connections should succeed only when the remote IP address is + # on link (doesn't need to be routed through a gateway). + # + + a=${NSB_IP} + log_start + do_run_cmd nettest -B -D -N "${NSA}" -O "${NSB}" -r ${a} --client-dontroute + log_test_addr ${a} $? 0 "SO_DONTROUTE client" + + a=${NSB_LO_IP} + log_start + show_hint "Should fail 'Network is unreachable' since server is not on link" + do_run_cmd nettest -B -D -N "${NSA}" -O "${NSB}" -r ${a} --client-dontroute + log_test_addr ${a} $? 1 "SO_DONTROUTE client" } ipv4_udp_vrf() |