From: David Miller <davem@davemloft.net> Date: 2012-09-04 19:58:38
From: Nicolas Dichtel <redacted>
Date: Thu, 30 Aug 2012 16:29:28 +0200
Comments are welcome.
I don't see why we have to create new flags for this.
Handle it like ipv4, where the RTN_* type dictates whether the
route is blackhole, prohibit, or other type of route.
From: Nicolas Dichtel <hidden> Date: 2012-09-05 09:37:42
When adding a blackhole or a prohibit route, they were handling like classic
routes. Moreover, it was only possible to add this kind of routes by specifying
an interface.
Bug already reported here:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=498498
Before the patch:
$ ip route add blackhole 2001::1/128
RTNETLINK answers: No such device
$ ip route add blackhole 2001::1/128 dev eth0
$ ip -6 route | grep 2001
2001::1 dev eth0 metric 1024
After:
$ ip route add blackhole 2001::1/128
$ ip -6 route | grep 2001
blackhole 2001::1 dev lo metric 1024 error -22
Signed-off-by: Nicolas Dichtel <redacted>
---
include/net/ip6_fib.h | 1 +
net/ipv6/route.c | 32 ++++++++++++++++++++++++++++----
2 files changed, 29 insertions(+), 4 deletions(-)
@@ -37,6 +37,7 @@ struct fib6_config {intfc_ifindex;u32fc_flags;u32fc_protocol;+u32fc_type;/* only 8 bits are used */structin6_addrfc_dst;structin6_addrfc_src;
@@ -2391,8 +2404,19 @@ static int rt6_fill_node(struct net *net,rtm->rtm_table=table;if(nla_put_u32(skb,RTA_TABLE,table))gotonla_put_failure;-if(rt->rt6i_flags&RTF_REJECT)-rtm->rtm_type=RTN_UNREACHABLE;+if(rt->rt6i_flags&RTF_REJECT){+switch(rt->dst.error){+case-EINVAL:+rtm->rtm_type=RTN_BLACKHOLE;+break;+case-EACCES:+rtm->rtm_type=RTN_PROHIBIT;+break;+default:+rtm->rtm_type=RTN_UNREACHABLE;+break;+}+}elseif(rt->rt6i_flags&RTF_LOCAL)rtm->rtm_type=RTN_LOCAL;elseif(rt->dst.dev&&(rt->dst.dev->flags&IFF_LOOPBACK))
From: Nicolas Dichtel <hidden> Date: 2012-09-05 10:03:41
Please, forget this patch, it's a wrong version.
Sorry for that.
Regards,
Nicolas
Le 05/09/2012 13:34, Nicolas Dichtel a écrit :
quoted hunk
When adding a blackhole or a prohibit route, they were handling like classic
routes. Moreover, it was only possible to add this kind of routes by specifying
an interface.
Bug already reported here:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=498498
Before the patch:
$ ip route add blackhole 2001::1/128
RTNETLINK answers: No such device
$ ip route add blackhole 2001::1/128 dev eth0
$ ip -6 route | grep 2001
2001::1 dev eth0 metric 1024
After:
$ ip route add blackhole 2001::1/128
$ ip -6 route | grep 2001
blackhole 2001::1 dev lo metric 1024 error -22
Signed-off-by: Nicolas Dichtel <redacted>
---
include/net/ip6_fib.h | 1 +
net/ipv6/route.c | 32 ++++++++++++++++++++++++++++----
2 files changed, 29 insertions(+), 4 deletions(-)
@@ -37,6 +37,7 @@ struct fib6_config {intfc_ifindex;u32fc_flags;u32fc_protocol;+u32fc_type;/* only 8 bits are used */structin6_addrfc_dst;structin6_addrfc_src;
@@ -2391,8 +2404,19 @@ static int rt6_fill_node(struct net *net,rtm->rtm_table=table;if(nla_put_u32(skb,RTA_TABLE,table))gotonla_put_failure;-if(rt->rt6i_flags&RTF_REJECT)-rtm->rtm_type=RTN_UNREACHABLE;+if(rt->rt6i_flags&RTF_REJECT){+switch(rt->dst.error){+case-EINVAL:+rtm->rtm_type=RTN_BLACKHOLE;+break;+case-EACCES:+rtm->rtm_type=RTN_PROHIBIT;+break;+default:+rtm->rtm_type=RTN_UNREACHABLE;+break;+}+}elseif(rt->rt6i_flags&RTF_LOCAL)rtm->rtm_type=RTN_LOCAL;elseif(rt->dst.dev&&(rt->dst.dev->flags&IFF_LOOPBACK))
--
Nicolas DICHTEL
6WIND
R&D Engineer
Tel: +33 1 39 30 92 10
Fax: +33 1 39 30 92 11
nicolas.dichtel@6wind.com
www.6wind.com
Twitter: http://twitter.com/6windsoftware
Join the Multicore Packet Processing Forum: www.multicorepacketprocessing.com
Ce courriel ainsi que toutes les pièces jointes, est uniquement destiné à son ou
ses destinataires. Il contient des informations confidentielles qui sont la
propriété de 6WIND. Toute révélation, distribution ou copie des informations
qu'il contient est strictement interdite. Si vous avez reçu ce message par
erreur, veuillez immédiatement le signaler à l'émetteur et détruire toutes les
données reçues.
This e-mail message, including any attachments, is for the sole use of the
intended recipient(s) and contains information that is confidential and
proprietary to 6WIND. All unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact the sender
by reply e-mail and destroy all copies of the original message.
From: Nicolas Dichtel <hidden> Date: 2012-09-05 10:10:44
When adding a blackhole or a prohibit route, they were handling like classic
routes. Moreover, it was only possible to add this kind of routes by specifying
an interface.
Bug already reported here:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=498498
Before the patch:
$ ip route add blackhole 2001::1/128
RTNETLINK answers: No such device
$ ip route add blackhole 2001::1/128 dev eth0
$ ip -6 route | grep 2001
2001::1 dev eth0 metric 1024
After:
$ ip route add blackhole 2001::1/128
$ ip -6 route | grep 2001
blackhole 2001::1 dev lo metric 1024 error -22
v2: wrong patch
v3: add a field fc_type in struct fib6_config to store RTN_* type
Signed-off-by: Nicolas Dichtel <redacted>
---
include/net/ip6_fib.h | 1 +
net/ipv6/route.c | 32 ++++++++++++++++++++++++++++----
2 files changed, 29 insertions(+), 4 deletions(-)
@@ -37,6 +37,7 @@ struct fib6_config {intfc_ifindex;u32fc_flags;u32fc_protocol;+u32fc_type;/* only 8 bits are used */structin6_addrfc_dst;structin6_addrfc_src;
@@ -2391,8 +2404,19 @@ static int rt6_fill_node(struct net *net,rtm->rtm_table=table;if(nla_put_u32(skb,RTA_TABLE,table))gotonla_put_failure;-if(rt->rt6i_flags&RTF_REJECT)-rtm->rtm_type=RTN_UNREACHABLE;+if(rt->rt6i_flags&RTF_REJECT){+switch(rt->dst.error){+case-EINVAL:+rtm->rtm_type=RTN_BLACKHOLE;+break;+case-EACCES:+rtm->rtm_type=RTN_PROHIBIT;+break;+default:+rtm->rtm_type=RTN_UNREACHABLE;+break;+}+}elseif(rt->rt6i_flags&RTF_LOCAL)rtm->rtm_type=RTN_LOCAL;elseif(rt->dst.dev&&(rt->dst.dev->flags&IFF_LOOPBACK))
When adding a blackhole or a prohibit route, they were handling like classic
routes. Moreover, it was only possible to add this kind of routes by specifying
an interface.
Bug already reported here:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=498498
Before the patch:
$ ip route add blackhole 2001::1/128
RTNETLINK answers: No such device
$ ip route add blackhole 2001::1/128 dev eth0
$ ip -6 route | grep 2001
2001::1 dev eth0 metric 1024
After:
$ ip route add blackhole 2001::1/128
$ ip -6 route | grep 2001
blackhole 2001::1 dev lo metric 1024 error -22
v2: wrong patch
v3: add a field fc_type in struct fib6_config to store RTN_* type
Signed-off-by: Nicolas Dichtel <redacted>
I like this a lot more than your original patch, applied to net-next,
thanks.