Skip to content

Commit 37de3b3

Browse files
Paolo Abenidavem330
authored andcommitted
selftests: fib_tests: add more tests for metric update
This patch adds two more tests to ipv4_addr_metric_test() to explicitly cover the scenarios fixed by the previous patch. Suggested-by: David Ahern <[email protected]> Signed-off-by: Paolo Abeni <[email protected]> Reviewed-by: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0b834ba commit 37de3b3

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tools/testing/selftests/net/fib_tests.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,6 +1438,27 @@ ipv4_addr_metric_test()
14381438
fi
14391439
log_test $rc 0 "Prefix route with metric on link up"
14401440

1441+
# explicitly check for metric changes on edge scenarios
1442+
run_cmd "$IP addr flush dev dummy2"
1443+
run_cmd "$IP addr add dev dummy2 172.16.104.0/24 metric 259"
1444+
run_cmd "$IP addr change dev dummy2 172.16.104.0/24 metric 260"
1445+
rc=$?
1446+
if [ $rc -eq 0 ]; then
1447+
check_route "172.16.104.0/24 dev dummy2 proto kernel scope link src 172.16.104.0 metric 260"
1448+
rc=$?
1449+
fi
1450+
log_test $rc 0 "Modify metric of .0/24 address"
1451+
1452+
run_cmd "$IP addr flush dev dummy2"
1453+
run_cmd "$IP addr add dev dummy2 172.16.104.1/32 peer 172.16.104.2 metric 260"
1454+
run_cmd "$IP addr change dev dummy2 172.16.104.1/32 peer 172.16.104.2 metric 261"
1455+
rc=$?
1456+
if [ $rc -eq 0 ]; then
1457+
check_route "172.16.104.2 dev dummy2 proto kernel scope link src 172.16.104.1 metric 261"
1458+
rc=$?
1459+
fi
1460+
log_test $rc 0 "Modify metric of address with peer route"
1461+
14411462
$IP li del dummy1
14421463
$IP li del dummy2
14431464
cleanup

0 commit comments

Comments
 (0)