Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests: fib_tests: add fib6 from ra to static test

The new test checks that a route that has been promoted from RA-learned
to static does not switch back when a new RA message arrives. In
addition, it checks that the route is owned by RA again when the static
address is removed.

Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
Link: https://patch.msgid.link/20251115095939.6967-2-fmancera@suse.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Fernando Fernandez Mancera and committed by
Jakub Kicinski
d7dbda87 f72514b3

+65 -1
+65 -1
tools/testing/selftests/net/fib_tests.sh
··· 11 11 ipv6_rt ipv4_rt ipv6_addr_metric ipv4_addr_metric ipv6_route_metrics \ 12 12 ipv4_route_metrics ipv4_route_v6_gw rp_filter ipv4_del_addr \ 13 13 ipv6_del_addr ipv4_mangle ipv6_mangle ipv4_bcast_neigh fib6_gc_test \ 14 - ipv4_mpath_list ipv6_mpath_list ipv4_mpath_balance ipv6_mpath_balance" 14 + ipv4_mpath_list ipv6_mpath_list ipv4_mpath_balance ipv6_mpath_balance \ 15 + fib6_ra_to_static" 15 16 16 17 VERBOSE=0 17 18 PAUSE_ON_FAIL=no ··· 1477 1476 route_cleanup 1478 1477 } 1479 1478 1479 + fib6_ra_to_static() 1480 + { 1481 + setup 1482 + 1483 + echo 1484 + echo "Fib6 route promotion from RA-learned to static test" 1485 + set -e 1486 + 1487 + # ra6 is required for the test. (ipv6toolkit) 1488 + if [ ! -x "$(command -v ra6)" ]; then 1489 + echo "SKIP: ra6 not found." 1490 + set +e 1491 + cleanup &> /dev/null 1492 + return 1493 + fi 1494 + 1495 + # Create a pair of veth devices to send a RA message from one 1496 + # device to another. 1497 + $IP link add veth1 type veth peer name veth2 1498 + $IP link set dev veth1 up 1499 + $IP link set dev veth2 up 1500 + $IP -6 address add 2001:10::1/64 dev veth1 nodad 1501 + $IP -6 address add 2001:10::2/64 dev veth2 nodad 1502 + 1503 + # Make veth1 ready to receive RA messages. 1504 + $NS_EXEC sysctl -wq net.ipv6.conf.veth1.accept_ra=2 1505 + 1506 + # Send a RA message with a prefix from veth2. 1507 + $NS_EXEC ra6 -i veth2 -d 2001:10::1 -P 2001:12::/64\#LA\#120\#60 1508 + 1509 + # Wait for the RA message. 1510 + sleep 1 1511 + 1512 + # systemd may mess up the test. Make sure that 1513 + # systemd-networkd.service and systemd-networkd.socket are stopped. 1514 + check_rt_num_clean 2 $($IP -6 route list|grep expires|wc -l) || return 1515 + 1516 + # Configure static address on the same prefix 1517 + $IP -6 address add 2001:12::dead/64 dev veth1 nodad 1518 + 1519 + # On-link route won't expire anymore, default route still owned by RA 1520 + check_rt_num 1 $($IP -6 route list |grep expires|wc -l) 1521 + 1522 + # Send a second RA message with a prefix from veth2. 1523 + $NS_EXEC ra6 -i veth2 -d 2001:10::1 -P 2001:12::/64\#LA\#120\#60 1524 + sleep 1 1525 + 1526 + # Expire is not back, on-link route is still static 1527 + check_rt_num 1 $($IP -6 route list |grep expires|wc -l) 1528 + 1529 + $IP -6 address del 2001:12::dead/64 dev veth1 nodad 1530 + 1531 + # Expire is back, on-link route is now owned by RA again 1532 + check_rt_num 2 $($IP -6 route list |grep expires|wc -l) 1533 + 1534 + log_test $ret 0 "ipv6 promote RA route to static" 1535 + 1536 + set +e 1537 + 1538 + cleanup &> /dev/null 1539 + } 1540 + 1480 1541 # add route for a prefix, flushing any existing routes first 1481 1542 # expected to be the first step of a test 1482 1543 add_route() ··· 2861 2798 ipv6_mpath_list) ipv6_mpath_list_test;; 2862 2799 ipv4_mpath_balance) ipv4_mpath_balance_test;; 2863 2800 ipv6_mpath_balance) ipv6_mpath_balance_test;; 2801 + fib6_ra_to_static) fib6_ra_to_static;; 2864 2802 2865 2803 help) echo "Test names: $TESTS"; exit 0;; 2866 2804 esac