Skip to content

Commit

Permalink
selftests: fcnal: Test SO_DONTROUTE on raw and ping sockets.
Browse files Browse the repository at this point in the history
Use ping -r to test the kernel behaviour with raw and ping sockets
having the SO_DONTROUTE option.

Since ipv4_ping_novrf() is called with different values of
net.ipv4.ping_group_range, then it tests both raw and ping sockets
(ping uses ping sockets if its user ID belongs to ping_group_range
and raw sockets otherwise).

With both socket types, 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>
  • Loading branch information
Guillaume Nault authored and David S. Miller committed May 12, 2023
1 parent a431327 commit ceec9f2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tools/testing/selftests/net/fcnal-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,20 @@ ipv4_ping_novrf()
log_test_addr ${a} $? 0 "ping out, address bind"
done

#
# out, but don't use gateway if peer is not on link
#
a=${NSB_IP}
log_start
run_cmd ping -c 1 -w 1 -r ${a}
log_test_addr ${a} $? 0 "ping out (don't route), peer on link"

a=${NSB_LO_IP}
log_start
show_hint "Fails since peer is not on link"
run_cmd ping -c 1 -w 1 -r ${a}
log_test_addr ${a} $? 1 "ping out (don't route), peer not on link"

#
# in
#
Expand Down

0 comments on commit ceec9f2

Please sign in to comment.