* IPv6 routing type - not at par with IPv4 one?
@ 2012-09-06 10:02 Markus Stenberg
2012-09-06 10:35 ` Eric Dumazet
0 siblings, 1 reply; 9+ messages in thread
From: Markus Stenberg @ 2012-09-06 10:02 UTC (permalink / raw)
To: netdev
~ # ip route add throw 1.2.3.4
~ # ip -6 route add throw ::1.2.3.4
RTNETLINK answers: No such device
~ # ip route add blackhole 1.2.3.5
~ # ip -6 route add blackhole ::1.2.3.5
RTNETLINK answers: No such device
~ #
The reason for this is in net/ipv6/route.c - ipv6_route_add:
Eventually code winds up at this (1423 line in 3.5.3):
err = -ENODEV;
if (!dev)
goto out;
and poof, ENODEV.
Is there some reason for this? Or should I write a patch?
Or does someone else want to? Support for dev=NULL
elsewhere in the code seems to be ok.
Based on quick googling I'm not the first one to have encountered this.
Cheers,
-Markus
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: IPv6 routing type - not at par with IPv4 one?
2012-09-06 10:02 IPv6 routing type - not at par with IPv4 one? Markus Stenberg
@ 2012-09-06 10:35 ` Eric Dumazet
2012-09-06 10:54 ` Markus
0 siblings, 1 reply; 9+ messages in thread
From: Eric Dumazet @ 2012-09-06 10:35 UTC (permalink / raw)
To: Markus Stenberg; +Cc: netdev, Nicolas Dichtel
On Thu, 2012-09-06 at 10:02 +0000, Markus Stenberg wrote:
> ~ # ip route add throw 1.2.3.4
> ~ # ip -6 route add throw ::1.2.3.4
> RTNETLINK answers: No such device
> ~ # ip route add blackhole 1.2.3.5
> ~ # ip -6 route add blackhole ::1.2.3.5
> RTNETLINK answers: No such device
> ~ #
>
> The reason for this is in net/ipv6/route.c - ipv6_route_add:
>
> Eventually code winds up at this (1423 line in 3.5.3):
>
> err = -ENODEV;
> if (!dev)
> goto out;
>
> and poof, ENODEV.
>
> Is there some reason for this? Or should I write a patch?
> Or does someone else want to? Support for dev=NULL
> elsewhere in the code seems to be ok.
>
> Based on quick googling I'm not the first one to have encountered this.
Well, it seems you missed this :
http://git.kernel.org/?p=linux/kernel/git/davem/net-next.git;a=commitdiff;h=ef2c7d7b59708d54213c7556a82d14de9a7e4475
At least the blackhole is now supported on IPv6, so you probably have to
add the 'throw' bit, if it makes any sense.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: IPv6 routing type - not at par with IPv4 one?
2012-09-06 10:35 ` Eric Dumazet
@ 2012-09-06 10:54 ` Markus
2012-09-06 13:21 ` Nicolas Dichtel
0 siblings, 1 reply; 9+ messages in thread
From: Markus @ 2012-09-06 10:54 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Markus Stenberg, netdev, Nicolas Dichtel
On 6.9.2012, at 13.35, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> Well, it seems you missed this :
>
> http://git.kernel.org/?p=linux/kernel/git/davem/net-next.git;a=commitdiff;h=ef2c7d7b59708d54213c7556a82d14de9a7e4475
>
> At least the blackhole is now supported on IPv6, so you probably have to
> add the 'throw' bit, if it makes any sense.
Ah, cool, teaches me to refresh my git trees before posting ;-)
Nicolas, want to update for that too or will I?
Throw is useful in various cases (it is RTN_THROW / -EAGAIN).
Cheers,
-Markus
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: IPv6 routing type - not at par with IPv4 one?
2012-09-06 10:54 ` Markus
@ 2012-09-06 13:21 ` Nicolas Dichtel
2012-09-06 15:53 ` [PATCH net-next] ipv6: fix handling of throw routes Nicolas Dichtel
0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Dichtel @ 2012-09-06 13:21 UTC (permalink / raw)
To: Markus; +Cc: Eric Dumazet, Markus Stenberg, netdev
Le 06/09/2012 12:54, Markus a écrit :
> On 6.9.2012, at 13.35, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>> Well, it seems you missed this :
>>
>> http://git.kernel.org/?p=linux/kernel/git/davem/net-next.git;a=commitdiff;h=ef2c7d7b59708d54213c7556a82d14de9a7e4475
>>
>> At least the blackhole is now supported on IPv6, so you probably have to
>> add the 'throw' bit, if it makes any sense.
>
>
> Ah, cool, teaches me to refresh my git trees before posting ;-)
> Nicolas, want to update for that too or will I?
Ok, I will send another patch for this.
Thank you,
Nicolas
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next] ipv6: fix handling of throw routes
2012-09-06 15:53 ` [PATCH net-next] ipv6: fix handling of throw routes Nicolas Dichtel
@ 2012-09-06 13:58 ` Eric Dumazet
2012-09-07 18:18 ` David Miller
1 sibling, 0 replies; 9+ messages in thread
From: Eric Dumazet @ 2012-09-06 13:58 UTC (permalink / raw)
To: Nicolas Dichtel; +Cc: davem, netdev, markus.stenberg
On Thu, 2012-09-06 at 11:53 -0400, Nicolas Dichtel wrote:
> It's the same problem that previous fix about blackhole and prohibit routes.
>
> When adding a throw route, it was handled like a classic route.
> Moreover, it was only possible to add this kind of routes by specifying
> an interface.
>
> Before the patch:
> $ ip route add throw 2001::2/128
> RTNETLINK answers: No such device
> $ ip route add throw 2001::2/128 dev eth0
> $ ip -6 route | grep 2001::2
> 2001::2 dev eth0 metric 1024
>
> After:
> $ ip route add throw 2001::2/128
> $ ip -6 route | grep 2001::2
> throw 2001::2 dev lo metric 1024 error -11
>
> Reported-by: Markus Stenberg <markus.stenberg@iki.fi>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> ---
> net/ipv6/route.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
Acked-by: Eric Dumazet <edumazet@google.com>
Thanks Nicolas
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH net-next] ipv6: fix handling of throw routes
2012-09-06 13:21 ` Nicolas Dichtel
@ 2012-09-06 15:53 ` Nicolas Dichtel
2012-09-06 13:58 ` Eric Dumazet
2012-09-07 18:18 ` David Miller
0 siblings, 2 replies; 9+ messages in thread
From: Nicolas Dichtel @ 2012-09-06 15:53 UTC (permalink / raw)
To: davem; +Cc: netdev, markus.stenberg, eric.dumazet, Nicolas Dichtel
It's the same problem that previous fix about blackhole and prohibit routes.
When adding a throw route, it was handled like a classic route.
Moreover, it was only possible to add this kind of routes by specifying
an interface.
Before the patch:
$ ip route add throw 2001::2/128
RTNETLINK answers: No such device
$ ip route add throw 2001::2/128 dev eth0
$ ip -6 route | grep 2001::2
2001::2 dev eth0 metric 1024
After:
$ ip route add throw 2001::2/128
$ ip -6 route | grep 2001::2
throw 2001::2 dev lo metric 1024 error -11
Reported-by: Markus Stenberg <markus.stenberg@iki.fi>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
net/ipv6/route.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index fa26444..339d921 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1471,6 +1471,9 @@ int ip6_route_add(struct fib6_config *cfg)
case RTN_PROHIBIT:
rt->dst.error = -EACCES;
break;
+ case RTN_THROW:
+ rt->dst.error = -EAGAIN;
+ break;
default:
rt->dst.error = -ENETUNREACH;
break;
@@ -2275,7 +2278,8 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
if (rtm->rtm_type == RTN_UNREACHABLE ||
rtm->rtm_type == RTN_BLACKHOLE ||
- rtm->rtm_type == RTN_PROHIBIT)
+ rtm->rtm_type == RTN_PROHIBIT ||
+ rtm->rtm_type == RTN_THROW)
cfg->fc_flags |= RTF_REJECT;
if (rtm->rtm_type == RTN_LOCAL)
@@ -2412,6 +2416,9 @@ static int rt6_fill_node(struct net *net,
case -EACCES:
rtm->rtm_type = RTN_PROHIBIT;
break;
+ case -EAGAIN:
+ rtm->rtm_type = RTN_THROW;
+ break;
default:
rtm->rtm_type = RTN_UNREACHABLE;
break;
--
1.7.12
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH net-next] ipv6: fix handling of throw routes
2012-09-06 15:53 ` [PATCH net-next] ipv6: fix handling of throw routes Nicolas Dichtel
2012-09-06 13:58 ` Eric Dumazet
@ 2012-09-07 18:18 ` David Miller
2012-09-10 7:15 ` Nicolas Dichtel
1 sibling, 1 reply; 9+ messages in thread
From: David Miller @ 2012-09-07 18:18 UTC (permalink / raw)
To: nicolas.dichtel; +Cc: netdev, markus.stenberg, eric.dumazet
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Thu, 6 Sep 2012 11:53:35 -0400
> It's the same problem that previous fix about blackhole and prohibit routes.
>
> When adding a throw route, it was handled like a classic route.
> Moreover, it was only possible to add this kind of routes by specifying
> an interface.
>
> Before the patch:
> $ ip route add throw 2001::2/128
> RTNETLINK answers: No such device
> $ ip route add throw 2001::2/128 dev eth0
> $ ip -6 route | grep 2001::2
> 2001::2 dev eth0 metric 1024
>
> After:
> $ ip route add throw 2001::2/128
> $ ip -6 route | grep 2001::2
> throw 2001::2 dev lo metric 1024 error -11
>
> Reported-by: Markus Stenberg <markus.stenberg@iki.fi>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Applied, thanks.
See how easy this was to implement via ->rtm_type? :-)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next] ipv6: fix handling of throw routes
2012-09-07 18:18 ` David Miller
@ 2012-09-10 7:15 ` Nicolas Dichtel
2013-01-24 10:11 ` Axel Neumann
0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Dichtel @ 2012-09-10 7:15 UTC (permalink / raw)
To: David Miller; +Cc: netdev, markus.stenberg, eric.dumazet
Le 07/09/2012 20:18, David Miller a écrit :
> From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> Date: Thu, 6 Sep 2012 11:53:35 -0400
>
>> It's the same problem that previous fix about blackhole and prohibit routes.
>>
>> When adding a throw route, it was handled like a classic route.
>> Moreover, it was only possible to add this kind of routes by specifying
>> an interface.
>>
>> Before the patch:
>> $ ip route add throw 2001::2/128
>> RTNETLINK answers: No such device
>> $ ip route add throw 2001::2/128 dev eth0
>> $ ip -6 route | grep 2001::2
>> 2001::2 dev eth0 metric 1024
>>
>> After:
>> $ ip route add throw 2001::2/128
>> $ ip -6 route | grep 2001::2
>> throw 2001::2 dev lo metric 1024 error -11
>>
>> Reported-by: Markus Stenberg <markus.stenberg@iki.fi>
>> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
>
> Applied, thanks.
>
> See how easy this was to implement via ->rtm_type? :-)
>
Definitely!
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next] ipv6: fix handling of throw routes
2012-09-10 7:15 ` Nicolas Dichtel
@ 2013-01-24 10:11 ` Axel Neumann
0 siblings, 0 replies; 9+ messages in thread
From: Axel Neumann @ 2013-01-24 10:11 UTC (permalink / raw)
To: netdev
Hi
Nicolas Dichtel <nicolas.dichtel <at> 6wind.com> writes:
>
> Le 07/09/2012 20:18, David Miller a écrit :
> > From: Nicolas Dichtel <nicolas.dichtel <at> 6wind.com>
> > Date: Thu, 6 Sep 2012 11:53:35 -0400
> >
> >> It's the same problem that previous fix about blackhole and prohibit routes.
> >>
> >> When adding a throw route, it was handled like a classic route.
> >> Moreover, it was only possible to add this kind of routes by specifying
> >> an interface.
> >>
> >> Before the patch:
> >> $ ip route add throw 2001::2/128
> >> RTNETLINK answers: No such device
> >> $ ip route add throw 2001::2/128 dev eth0
> >> $ ip -6 route | grep 2001::2
> >> 2001::2 dev eth0 metric 1024
> >>
> >> After:
> >> $ ip route add throw 2001::2/128
> >> $ ip -6 route | grep 2001::2
> >> throw 2001::2 dev lo metric 1024 error -11
> >>
> >> Reported-by: Markus Stenberg <markus.stenberg <at> iki.fi>
> >> Signed-off-by: Nicolas Dichtel <nicolas.dichtel <at> 6wind.com>
> >
> > Applied, thanks.
Although 'ip -6 route show' now reports a "throw" instead of an "unreachable"
route the behavior of a configured IPv6 "throw" route still seems incorrect and
similar to that of an "unreachable" route!
I've tested with kernel 3.7.4 which includes this patch:
http://git.kernel.org/?p=linux/kernel/git/davem/net-next.git;a=commitdiff;h=ef2c7d7b59708d54213c7556a82d14de9a7e4475
An example scenario using a dedicated routing table (IMHO the main use case for
throw routes) is given below...
greetings
/axel
The following scenario shows an example:
computer 1001 and 1002 connected via ethernet eth2
computer 1002 has 1001:2::2/64 on eth2
Now at computer 1001:
root@mlc1001:~# ping6 1001:2::2 -c 1
connect: Network is unreachable
root@mlc1001:~# ip a add 1001:2::1/64 dev eth2
root@mlc1001:~# ip -6 rule add from all lookup 10 pref 1000
root@mlc1001:~# ip -6 rule
0: from all lookup local
1000: from all lookup 10
32766: from all lookup main
root@mlc1001:~# ip -6 route list table 10
root@mlc1001:~# ping6 1001:2::2 -c 1
PING 1001:2::2(1001:2::2) 56 data bytes
64 bytes from 1001:2::2: icmp_seq=1 ttl=64 time=0.263 ms
--- 1001:2::2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.263/0.263/0.263/0.000 ms
root@mlc1001:~# ip -6 route add throw 1001:2::/64 table 10
root@mlc1001:~# ip -6 route list table 10
throw 1001:2::/64 dev lo metric 1024 error -11
root@mlc1001:~# ping6 1001:2::2 -c 1
connect: Resource temporarily unavailable
# Although the destination lookup should only be thrown for table 10
# and continue on the main table where a valid local route exists
# it fails. For remote throw routes the error says something like:
# From 1001:2::2 icmp_seq=1 Destination unreachable: No route
# Removing the throw route again it works again...
root@mlc1001:~# ip -6 r
1001:2::/64 dev eth2 proto kernel metric 256
fe80::/64 dev eth0 proto kernel metric 256
fe80::/64 dev eth1 proto kernel metric 256
fe80::/64 dev eth2 proto kernel metric 256
root@mlc1001:~# ip -6 route del throw 1001:2::/64 table 10
root@mlc1001:~# ping6 1001:2::2 -c 1
PING 1001:2::2(1001:2::2) 56 data bytes
64 bytes from 1001:2::2: icmp_seq=1 ttl=64 time=0.264 ms
--- 1001:2::2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.264/0.264/0.264/0.000 ms
root@mlc1001:~# ip -6 r
1001:2::2 via 1001:2::2 dev eth2 metric 0
cache
1001:2::/64 dev eth2 proto kernel metric 256
fe80::/64 dev eth0 proto kernel metric 256
fe80::/64 dev eth1 proto kernel metric 256
fe80::/64 dev eth2 proto kernel metric 256
root@mlc1001:~#
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-01-24 10:14 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-06 10:02 IPv6 routing type - not at par with IPv4 one? Markus Stenberg
2012-09-06 10:35 ` Eric Dumazet
2012-09-06 10:54 ` Markus
2012-09-06 13:21 ` Nicolas Dichtel
2012-09-06 15:53 ` [PATCH net-next] ipv6: fix handling of throw routes Nicolas Dichtel
2012-09-06 13:58 ` Eric Dumazet
2012-09-07 18:18 ` David Miller
2012-09-10 7:15 ` Nicolas Dichtel
2013-01-24 10:11 ` Axel Neumann
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).