Skip to content

Commit

Permalink
nexthops: Add selftests for cleanup of known bad route add
Browse files Browse the repository at this point in the history
Test cleanup path for routes usinig nexthop objects before the
reference is taken on the nexthop. Specifically, bad metric for
ipv4 and ipv6 and source routing for ipv6.

Selftests that correspond to the recent bug fix:
    821bbf7 ("ipv6: Fix KASAN: slab-out-of-bounds Read in fib6_nh_flush_exceptions")

Signed-off-by: David Ahern <dsahern@kernel.org>
Cc: Coco Li <lixiaoyan@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David Ahern authored and David S. Miller committed Jun 14, 2021
1 parent a212d9f commit 2d7ff2d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tools/testing/selftests/net/fib_nexthops.sh
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,14 @@ ipv6_fcnal_runtime()
run_cmd "$IP nexthop add id 86 via 2001:db8:91::2 dev veth1"
run_cmd "$IP ro add 2001:db8:101::1/128 nhid 81"

# route can not use prefsrc with nexthops
run_cmd "$IP ro add 2001:db8:101::2/128 nhid 86 from 2001:db8:91::1"
log_test $? 2 "IPv6 route can not use src routing with external nexthop"

# check cleanup path on invalid metric
run_cmd "$IP ro add 2001:db8:101::2/128 nhid 86 congctl lock foo"
log_test $? 2 "IPv6 route with invalid metric"

# rpfilter and default route
$IP nexthop flush >/dev/null 2>&1
run_cmd "ip netns exec me ip6tables -t mangle -I PREROUTING 1 -m rpfilter --invert -j DROP"
Expand Down Expand Up @@ -1366,6 +1374,10 @@ ipv4_fcnal_runtime()
run_cmd "$IP nexthop replace id 22 via 172.16.2.2 dev veth3"
log_test $? 2 "Nexthop replace with invalid scope for existing route"

# check cleanup path on invalid metric
run_cmd "$IP ro add 172.16.101.2/32 nhid 22 congctl lock foo"
log_test $? 2 "IPv4 route with invalid metric"

#
# add route with nexthop and check traffic
#
Expand Down

0 comments on commit 2d7ff2d

Please sign in to comment.