kselftests: fib_rule_tests: fix "from $SRC_IP iif $DEV" match testing
Subsystems (4)
cover kselftests: fib_rule_tests: fix "from $SRC_IP iif $DEV" match testing
As all the IPv4 testing addresses are in the same subnet and egress device == ingress device, to pass "from $SRC_IP iif $DEV" match test, we need enable forwarding to get the route entry.
Hangbin Liu (2):
selftests: fib_rule_tests: fix local IPv4 address typo
selftests: fib_rule_tests: enable forwarding before ipv4 from/iif test
tools/testing/selftests/net/fib_rule_tests.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
Signature · 1 line
2.19.2
PATCH 1/2 selftests: fib_rule_tests: fix local IPv4 address typo
The IPv4 testing address are all in 192.51.100.0 subnet. It doesn't make sense to set a 198.51.100.1 local address. Should be a typo.
--- tools/testing/selftests/net/fib_rule_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/fib_rule_tests.sh +1 -1
@@ -55,7 +55,7 @@ setup() $IP link add dummy0 type dummy $IP link set dev dummy0 up - $IP address add 198.51.100.1/24 dev dummy0 + $IP address add 192.51.100.1/24 dev dummy0 $IP -6 address add 2001:db8:1::1/64 dev dummy0 set +e
Signature · 1 line
2.19.2
Re: [PATCH net 1/2] selftests: fib_rule_tests: fix local IPv4 address typo
Quoted 2 lines · Hangbin Liu
The IPv4 testing address are all in 192.51.100.0 subnet. It doesn't make sense to set a 198.51.100.1 local address. Should be a typo.
The unused DEV_ADDR suggests you are correct. That should be removed as well or the IPv6 address encoded and used for consistency.
Quoted 13 lines
Fixes 65b2b4939a64 ("selftests: net: initial fib rule tests")Signed-off-by Hangbin Liu <[email protected]>--- tools/testing/selftests/net/fib_rule_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/testing/selftests/net/fib_rule_tests.sh +0
-0
tools/testing/selftests/net/fib_rule_tests.sh setup() · line 61
Quoted 8 lines
tools/testing/selftests/net/fib_rule_tests.sh +1
-1@@ -55,7 +55,7 @@ setup() $IP link add dummy0 type dummy $IP link set dev dummy0 up - $IP address add 198.51.100.1/24 dev dummy0 + $IP address add 192.51.100.1/24 dev dummy0 $IP -6 address add 2001:db8:1::1/64 dev dummy0 set +e
PATCH 2/2 selftests: fib_rule_tests: enable forwarding before ipv4 from/iif test
In reply to Hangbin LiuAs all the testing addresses are in the same subnet and egress device == ingress device. We need enable forwarding to get the route entry.
Also disable rp_filer separately as some distributions enable it in startup scripts.
--- tools/testing/selftests/net/fib_rule_tests.sh | 5 +++++ 1 file changed, 5 insertions(+)
tools/testing/selftests/net/fib_rule_tests.sh +5 -0
@@ -186,8 +186,13 @@ fib_rule4_test() match="oif $DEV" fib_rule4_test_match_n_redirect "$match" "$match" "oif redirect to table" + # need enable forwarding and disable rp_filter temporarily as all the + # addresses are in the same subnet and egress device == ingress device. + ip netns exec testns sysctl -w net.ipv4.ip_forward=1 + ip netns exec testns sysctl -w net.ipv4.conf.$DEV.rp_filter=0 match="from $SRC_IP iif $DEV" fib_rule4_test_match_n_redirect "$match" "$match" "iif redirect to table" + ip netns exec testns sysctl -w net.ipv4.ip_forward=0 match="tos 0x10" fib_rule4_test_match_n_redirect "$match" "$match" "tos redirect to table"
Signature · 1 line
2.19.2
David Miller
maintainerFrom: Hangbin Liu <[email protected]>
Date: Mon, 20 May 2019 12:36:53 +0800
Quoted 3 lines
As all the IPv4 testing addresses are in the same subnet and egress device == ingress device, to pass "from $SRC_IP iif $DEV" match test, we need enable forwarding to get the route entry.
Series applied, thanks.