netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] selftests: fib_rule_tests: Fix icmp proto with ipv6
@ 2019-04-29 17:30 David Ahern
  2019-04-30  2:37 ` Hangbin Liu
  2019-05-01 15:31 ` David Miller
  0 siblings, 2 replies; 6+ messages in thread
From: David Ahern @ 2019-04-29 17:30 UTC (permalink / raw)
  To: davem; +Cc: netdev, liuhangbin, David Ahern

From: David Ahern <dsahern@gmail.com>

A recent commit returns an error if icmp is used as the ip-proto for
IPv6 fib rules. Update fib_rule_tests to send ipv6-icmp instead of icmp.

Fixes: 5e1a99eae8499 ("ipv4: Add ICMPv6 support when parse route ipproto")
Signed-off-by: David Ahern <dsahern@gmail.com>
---
 tools/testing/selftests/net/fib_rule_tests.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/net/fib_rule_tests.sh b/tools/testing/selftests/net/fib_rule_tests.sh
index d4cfb6a7a086..5b92c1f4dc04 100755
--- a/tools/testing/selftests/net/fib_rule_tests.sh
+++ b/tools/testing/selftests/net/fib_rule_tests.sh
@@ -147,8 +147,8 @@ fib_rule6_test()
 
 	fib_check_iproute_support "ipproto" "ipproto"
 	if [ $? -eq 0 ]; then
-		match="ipproto icmp"
-		fib_rule6_test_match_n_redirect "$match" "$match" "ipproto icmp match"
+		match="ipproto ipv6-icmp"
+		fib_rule6_test_match_n_redirect "$match" "$match" "ipproto ipv6-icmp match"
 	fi
 }
 
-- 
2.11.0


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

* Re: [PATCH net] selftests: fib_rule_tests: Fix icmp proto with ipv6
  2019-04-29 17:30 [PATCH net] selftests: fib_rule_tests: Fix icmp proto with ipv6 David Ahern
@ 2019-04-30  2:37 ` Hangbin Liu
  2019-04-30 18:00   ` David Ahern
  2019-05-01 15:31 ` David Miller
  1 sibling, 1 reply; 6+ messages in thread
From: Hangbin Liu @ 2019-04-30  2:37 UTC (permalink / raw)
  To: David Ahern; +Cc: davem, netdev, David Ahern

On Mon, Apr 29, 2019 at 10:30:09AM -0700, David Ahern wrote:
> From: David Ahern <dsahern@gmail.com>
> 
> A recent commit returns an error if icmp is used as the ip-proto for
> IPv6 fib rules. Update fib_rule_tests to send ipv6-icmp instead of icmp.
> 
> Fixes: 5e1a99eae8499 ("ipv4: Add ICMPv6 support when parse route ipproto")
> Signed-off-by: David Ahern <dsahern@gmail.com>

Yes, I also found this issue and have the same patch in my pipeline...

There are two other issues with the fib_rules_tests. The first is the test
didn't check the nfail and will always return 0. I will post the fix later.

An other issue is The IPv4 rule 'from iif' check test failed while IPv6
passed. I haven't found out the reason yet.

# ip -netns testns rule add from 192.51.100.3 iif dummy0 table 100
# ip -netns testns route get 192.51.100.2 from 192.51.100.3 iif dummy0
RTNETLINK answers: No route to host

    TEST: rule4 check: from 192.51.100.3 iif dummy0           [FAIL]

# ip -netns testns -6 rule add from 2001:db8:1::3 iif dummy0 table 100
# ip -netns testns -6 route get 2001:db8:1::2 from 2001:db8:1::3 iif dummy0
2001:db8:1::2 via 2001:db8:1::2 dev dummy0 table 100 metric 1024 iif dummy0 pref medium

    TEST: rule6 check: from 2001:db8:1::3 iif dummy0          [ OK ]

Thanks
Hangbin

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

* Re: [PATCH net] selftests: fib_rule_tests: Fix icmp proto with ipv6
  2019-04-30  2:37 ` Hangbin Liu
@ 2019-04-30 18:00   ` David Ahern
  2019-05-07  8:20     ` Hangbin Liu
  0 siblings, 1 reply; 6+ messages in thread
From: David Ahern @ 2019-04-30 18:00 UTC (permalink / raw)
  To: Hangbin Liu, David Ahern; +Cc: davem, netdev

On 4/29/19 8:37 PM, Hangbin Liu wrote:
> An other issue is The IPv4 rule 'from iif' check test failed while IPv6
> passed. I haven't found out the reason yet.
> 
> # ip -netns testns rule add from 192.51.100.3 iif dummy0 table 100
> # ip -netns testns route get 192.51.100.2 from 192.51.100.3 iif dummy0
> RTNETLINK answers: No route to host
> 
>     TEST: rule4 check: from 192.51.100.3 iif dummy0           [FAIL]
> 
> # ip -netns testns -6 rule add from 2001:db8:1::3 iif dummy0 table 100
> # ip -netns testns -6 route get 2001:db8:1::2 from 2001:db8:1::3 iif dummy0
> 2001:db8:1::2 via 2001:db8:1::2 dev dummy0 table 100 metric 1024 iif dummy0 pref medium
> 
>     TEST: rule6 check: from 2001:db8:1::3 iif dummy0          [ OK ]

use perf to look at the fib lookup parameters:
  perf record -e fib:* -- ip -netns testns route get 192.51.100.2 from
192.51.100.3 iif dummy0
  perf script

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

* Re: [PATCH net] selftests: fib_rule_tests: Fix icmp proto with ipv6
  2019-04-29 17:30 [PATCH net] selftests: fib_rule_tests: Fix icmp proto with ipv6 David Ahern
  2019-04-30  2:37 ` Hangbin Liu
@ 2019-05-01 15:31 ` David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2019-05-01 15:31 UTC (permalink / raw)
  To: dsahern; +Cc: netdev, liuhangbin, dsahern

From: David Ahern <dsahern@kernel.org>
Date: Mon, 29 Apr 2019 10:30:09 -0700

> From: David Ahern <dsahern@gmail.com>
> 
> A recent commit returns an error if icmp is used as the ip-proto for
> IPv6 fib rules. Update fib_rule_tests to send ipv6-icmp instead of icmp.
> 
> Fixes: 5e1a99eae8499 ("ipv4: Add ICMPv6 support when parse route ipproto")
> Signed-off-by: David Ahern <dsahern@gmail.com>

Applied.

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

* Re: [PATCH net] selftests: fib_rule_tests: Fix icmp proto with ipv6
  2019-04-30 18:00   ` David Ahern
@ 2019-05-07  8:20     ` Hangbin Liu
  2019-05-08 19:38       ` David Ahern
  0 siblings, 1 reply; 6+ messages in thread
From: Hangbin Liu @ 2019-05-07  8:20 UTC (permalink / raw)
  To: David Ahern; +Cc: Roopa Prabhu, davem, netdev

On Tue, Apr 30, 2019 at 12:00:46PM -0600, David Ahern wrote:
> On 4/29/19 8:37 PM, Hangbin Liu wrote:
> > An other issue is The IPv4 rule 'from iif' check test failed while IPv6
> > passed. I haven't found out the reason yet.
> > 
> > # ip -netns testns rule add from 192.51.100.3 iif dummy0 table 100
> > # ip -netns testns route get 192.51.100.2 from 192.51.100.3 iif dummy0
> > RTNETLINK answers: No route to host
> > 
> >     TEST: rule4 check: from 192.51.100.3 iif dummy0           [FAIL]
> > 
> > # ip -netns testns -6 rule add from 2001:db8:1::3 iif dummy0 table 100
> > # ip -netns testns -6 route get 2001:db8:1::2 from 2001:db8:1::3 iif dummy0
> > 2001:db8:1::2 via 2001:db8:1::2 dev dummy0 table 100 metric 1024 iif dummy0 pref medium
> > 
> >     TEST: rule6 check: from 2001:db8:1::3 iif dummy0          [ OK ]
> 
> use perf to look at the fib lookup parameters:
>   perf record -e fib:* -- ip -netns testns route get 192.51.100.2 from
> 192.51.100.3 iif dummy0
>   perf script

Hi David, Roopa,

From the perf record the result looks good.
fib_table_lookup could get correct route.

For IPv4:
ip  7155 [001]  8442.915515: fib:fib_table_lookup: table 255 oif 0 iif 2 proto 0 192.51.100.3/0 -> 192.51.100.2/0 tos 0 scope 0 flags 0 ==> dev - gw 0.0.0.0 src 0.0.0.0 err -11
ip  7155 [001]  8442.915517: fib:fib_table_lookup: table 100 oif 0 iif 2 proto 0 192.51.100.3/0 -> 192.51.100.2/0 tos 0 scope 0 flags 0 ==> dev dummy0 gw 192.51.100.2 src 198.51.100.1 err 0

For IPv6:
ip  6950 [000]   759.328850: fib6:fib6_table_lookup: table 255 oif 0 iif 2 proto 0 2001:db8:1::3/0 -> 2001:db8:1::2/0 tos 0 scope 0 flags 0 ==> dev lo gw :: err -113
ip  6950 [000]   759.328852: fib6:fib6_table_lookup: table 100 oif 0 iif 2 proto 0 2001:db8:1::3/0 -> 2001:db8:1::2/0 tos 0 scope 0 flags 0 ==> dev dummy0 gw 2001:db8:1::2 err 0


Then I tracked the code and found in function ip_route_input_slow(),
after fib_lookup(), we got res->type == RTN_UNICAST. So if we haven't
enabled forwarding, it will return -EHOSTUNREACH.

But even we enabled forwarding, we still need to disable rp_filter as the
source/dest address are in the same subnet. The ip_mkroute_input()
-> __mkroute_input() -> fib_validate_source() -> __fib_validate_source() will
return -EXDEV if we enabled rp_filter.

So do you think if we should enable forwarding and disble rp_filter before
test "from $SRC_IP iif $DEV" or just diable this test directly?

Thanks
Hangbin

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

* Re: [PATCH net] selftests: fib_rule_tests: Fix icmp proto with ipv6
  2019-05-07  8:20     ` Hangbin Liu
@ 2019-05-08 19:38       ` David Ahern
  0 siblings, 0 replies; 6+ messages in thread
From: David Ahern @ 2019-05-08 19:38 UTC (permalink / raw)
  To: Hangbin Liu; +Cc: Roopa Prabhu, davem, netdev

On 5/7/19 2:20 AM, Hangbin Liu wrote:
> On Tue, Apr 30, 2019 at 12:00:46PM -0600, David Ahern wrote:
>> On 4/29/19 8:37 PM, Hangbin Liu wrote:
>>> An other issue is The IPv4 rule 'from iif' check test failed while IPv6
>>> passed. I haven't found out the reason yet.
>>>
>>> # ip -netns testns rule add from 192.51.100.3 iif dummy0 table 100
>>> # ip -netns testns route get 192.51.100.2 from 192.51.100.3 iif dummy0
>>> RTNETLINK answers: No route to host
>>>
>>>     TEST: rule4 check: from 192.51.100.3 iif dummy0           [FAIL]
>>>
>>> # ip -netns testns -6 rule add from 2001:db8:1::3 iif dummy0 table 100
>>> # ip -netns testns -6 route get 2001:db8:1::2 from 2001:db8:1::3 iif dummy0
>>> 2001:db8:1::2 via 2001:db8:1::2 dev dummy0 table 100 metric 1024 iif dummy0 pref medium
>>>
>>>     TEST: rule6 check: from 2001:db8:1::3 iif dummy0          [ OK ]
>>
>> use perf to look at the fib lookup parameters:
>>   perf record -e fib:* -- ip -netns testns route get 192.51.100.2 from
>> 192.51.100.3 iif dummy0
>>   perf script
> 
> Hi David, Roopa,
> 
> From the perf record the result looks good.
> fib_table_lookup could get correct route.
> 
> For IPv4:
> ip  7155 [001]  8442.915515: fib:fib_table_lookup: table 255 oif 0 iif 2 proto 0 192.51.100.3/0 -> 192.51.100.2/0 tos 0 scope 0 flags 0 ==> dev - gw 0.0.0.0 src 0.0.0.0 err -11
> ip  7155 [001]  8442.915517: fib:fib_table_lookup: table 100 oif 0 iif 2 proto 0 192.51.100.3/0 -> 192.51.100.2/0 tos 0 scope 0 flags 0 ==> dev dummy0 gw 192.51.100.2 src 198.51.100.1 err 0
> 
> For IPv6:
> ip  6950 [000]   759.328850: fib6:fib6_table_lookup: table 255 oif 0 iif 2 proto 0 2001:db8:1::3/0 -> 2001:db8:1::2/0 tos 0 scope 0 flags 0 ==> dev lo gw :: err -113
> ip  6950 [000]   759.328852: fib6:fib6_table_lookup: table 100 oif 0 iif 2 proto 0 2001:db8:1::3/0 -> 2001:db8:1::2/0 tos 0 scope 0 flags 0 ==> dev dummy0 gw 2001:db8:1::2 err 0
> 
> 
> Then I tracked the code and found in function ip_route_input_slow(),
> after fib_lookup(), we got res->type == RTN_UNICAST. So if we haven't
> enabled forwarding, it will return -EHOSTUNREACH.
> 
> But even we enabled forwarding, we still need to disable rp_filter as the
> source/dest address are in the same subnet. The ip_mkroute_input()
> -> __mkroute_input() -> fib_validate_source() -> __fib_validate_source() will
> return -EXDEV if we enabled rp_filter.
> 
> So do you think if we should enable forwarding and disble rp_filter before
> test "from $SRC_IP iif $DEV" or just diable this test directly?
> 

seems to me the test is a bit off; the source, gateway and address on
dummy are all in the same subnet. egress device == ingress device would
cause a redirect. That is right after the valiate_source check.

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

end of thread, other threads:[~2019-05-08 19:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-29 17:30 [PATCH net] selftests: fib_rule_tests: Fix icmp proto with ipv6 David Ahern
2019-04-30  2:37 ` Hangbin Liu
2019-04-30 18:00   ` David Ahern
2019-05-07  8:20     ` Hangbin Liu
2019-05-08 19:38       ` David Ahern
2019-05-01 15:31 ` 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).