aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorNicolas Dichtel <nicolas.dichtel@6wind.com>2012-09-06 01:53:35 -0400
committerDavid S. Miller <davem@davemloft.net>2012-09-07 14:17:10 -0400
commitb4949ab269a20e9af9a0c40729bac56e8f8a43a2 (patch)
tree201086f7d10ad9e854b909804c0a25bc6d69b65e /net/ipv6
parent7ab4551f3b391818e29263279031dca1e26417c6 (diff)
ipv6: fix handling of throw routes
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> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/route.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index fa264447a751..339d921cf3b6 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1471,6 +1471,9 @@ int ip6_route_add(struct fib6_config *cfg)
1471 case RTN_PROHIBIT: 1471 case RTN_PROHIBIT:
1472 rt->dst.error = -EACCES; 1472 rt->dst.error = -EACCES;
1473 break; 1473 break;
1474 case RTN_THROW:
1475 rt->dst.error = -EAGAIN;
1476 break;
1474 default: 1477 default:
1475 rt->dst.error = -ENETUNREACH; 1478 rt->dst.error = -ENETUNREACH;
1476 break; 1479 break;
@@ -2275,7 +2278,8 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
2275 2278
2276 if (rtm->rtm_type == RTN_UNREACHABLE || 2279 if (rtm->rtm_type == RTN_UNREACHABLE ||
2277 rtm->rtm_type == RTN_BLACKHOLE || 2280 rtm->rtm_type == RTN_BLACKHOLE ||
2278 rtm->rtm_type == RTN_PROHIBIT) 2281 rtm->rtm_type == RTN_PROHIBIT ||
2282 rtm->rtm_type == RTN_THROW)
2279 cfg->fc_flags |= RTF_REJECT; 2283 cfg->fc_flags |= RTF_REJECT;
2280 2284
2281 if (rtm->rtm_type == RTN_LOCAL) 2285 if (rtm->rtm_type == RTN_LOCAL)
@@ -2412,6 +2416,9 @@ static int rt6_fill_node(struct net *net,
2412 case -EACCES: 2416 case -EACCES:
2413 rtm->rtm_type = RTN_PROHIBIT; 2417 rtm->rtm_type = RTN_PROHIBIT;
2414 break; 2418 break;
2419 case -EAGAIN:
2420 rtm->rtm_type = RTN_THROW;
2421 break;
2415 default: 2422 default:
2416 rtm->rtm_type = RTN_UNREACHABLE; 2423 rtm->rtm_type = RTN_UNREACHABLE;
2417 break; 2424 break;