netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/2] kselftests: fib_rule_tests: fix "from $SRC_IP iif $DEV" match testing
@ 2019-05-20  4:36 Hangbin Liu
  2019-05-20  4:36 ` [PATCH net 1/2] selftests: fib_rule_tests: fix local IPv4 address typo Hangbin Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Hangbin Liu @ 2019-05-20  4:36 UTC (permalink / raw)
  To: netdev; +Cc: David Ahern, Roopa Prabhu, davem, Hangbin Liu

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(-)

-- 
2.19.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net 1/2] selftests: fib_rule_tests: fix local IPv4 address typo
  2019-05-20  4:36 [PATCH net 0/2] kselftests: fib_rule_tests: fix "from $SRC_IP iif $DEV" match testing Hangbin Liu
@ 2019-05-20  4:36 ` Hangbin Liu
  2019-05-20 21:42   ` David Ahern
  2019-05-20  4:36 ` [PATCH net 2/2] selftests: fib_rule_tests: enable forwarding before ipv4 from/iif test Hangbin Liu
  2019-05-21  0:20 ` [PATCH net 0/2] kselftests: fib_rule_tests: fix "from $SRC_IP iif $DEV" match testing David Miller
  2 siblings, 1 reply; 5+ messages in thread
From: Hangbin Liu @ 2019-05-20  4:36 UTC (permalink / raw)
  To: netdev; +Cc: David Ahern, Roopa Prabhu, davem, 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.

Fixes: 65b2b4939a64 ("selftests: net: initial fib rule tests")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
 tools/testing/selftests/net/fib_rule_tests.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/fib_rule_tests.sh b/tools/testing/selftests/net/fib_rule_tests.sh
index 4b7e107865bf..1ba069967fa2 100755
--- a/tools/testing/selftests/net/fib_rule_tests.sh
+++ b/tools/testing/selftests/net/fib_rule_tests.sh
@@ -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
-- 
2.19.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net 2/2] selftests: fib_rule_tests: enable forwarding before ipv4 from/iif test
  2019-05-20  4:36 [PATCH net 0/2] kselftests: fib_rule_tests: fix "from $SRC_IP iif $DEV" match testing Hangbin Liu
  2019-05-20  4:36 ` [PATCH net 1/2] selftests: fib_rule_tests: fix local IPv4 address typo Hangbin Liu
@ 2019-05-20  4:36 ` Hangbin Liu
  2019-05-21  0:20 ` [PATCH net 0/2] kselftests: fib_rule_tests: fix "from $SRC_IP iif $DEV" match testing David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: Hangbin Liu @ 2019-05-20  4:36 UTC (permalink / raw)
  To: netdev; +Cc: David Ahern, Roopa Prabhu, davem, Hangbin Liu

As 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.

Fixes: 65b2b4939a64 ("selftests: net: initial fib rule tests")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
 tools/testing/selftests/net/fib_rule_tests.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/testing/selftests/net/fib_rule_tests.sh b/tools/testing/selftests/net/fib_rule_tests.sh
index 1ba069967fa2..617321d3b801 100755
--- a/tools/testing/selftests/net/fib_rule_tests.sh
+++ b/tools/testing/selftests/net/fib_rule_tests.sh
@@ -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"
-- 
2.19.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net 1/2] selftests: fib_rule_tests: fix local IPv4 address typo
  2019-05-20  4:36 ` [PATCH net 1/2] selftests: fib_rule_tests: fix local IPv4 address typo Hangbin Liu
@ 2019-05-20 21:42   ` David Ahern
  0 siblings, 0 replies; 5+ messages in thread
From: David Ahern @ 2019-05-20 21:42 UTC (permalink / raw)
  To: Hangbin Liu, netdev; +Cc: Roopa Prabhu, davem

On 5/19/19 10:36 PM, Hangbin Liu wrote:
> 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.

> 
> Fixes: 65b2b4939a64 ("selftests: net: initial fib rule tests")
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> ---
>  tools/testing/selftests/net/fib_rule_tests.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/net/fib_rule_tests.sh b/tools/testing/selftests/net/fib_rule_tests.sh
> index 4b7e107865bf..1ba069967fa2 100755
> --- a/tools/testing/selftests/net/fib_rule_tests.sh
> +++ b/tools/testing/selftests/net/fib_rule_tests.sh
> @@ -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
> 

Reviewed-by: David Ahern <dsahern@gmail.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net 0/2] kselftests: fib_rule_tests: fix "from $SRC_IP iif $DEV" match testing
  2019-05-20  4:36 [PATCH net 0/2] kselftests: fib_rule_tests: fix "from $SRC_IP iif $DEV" match testing Hangbin Liu
  2019-05-20  4:36 ` [PATCH net 1/2] selftests: fib_rule_tests: fix local IPv4 address typo Hangbin Liu
  2019-05-20  4:36 ` [PATCH net 2/2] selftests: fib_rule_tests: enable forwarding before ipv4 from/iif test Hangbin Liu
@ 2019-05-21  0:20 ` David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2019-05-21  0:20 UTC (permalink / raw)
  To: liuhangbin; +Cc: netdev, dsahern, roopa

From: Hangbin Liu <liuhangbin@gmail.com>
Date: Mon, 20 May 2019 12:36:53 +0800

> 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-05-21  0:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-20  4:36 [PATCH net 0/2] kselftests: fib_rule_tests: fix "from $SRC_IP iif $DEV" match testing Hangbin Liu
2019-05-20  4:36 ` [PATCH net 1/2] selftests: fib_rule_tests: fix local IPv4 address typo Hangbin Liu
2019-05-20 21:42   ` David Ahern
2019-05-20  4:36 ` [PATCH net 2/2] selftests: fib_rule_tests: enable forwarding before ipv4 from/iif test Hangbin Liu
2019-05-21  0:20 ` [PATCH net 0/2] kselftests: fib_rule_tests: fix "from $SRC_IP iif $DEV" match testing David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).