* [Patch v4] IPv6: Fixed support for blackhole and prohibit routes
@ 2013-12-02 14:25 Kamala R
2013-12-02 15:34 ` Hannes Frederic Sowa
2013-12-02 22:16 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Kamala R @ 2013-12-02 14:25 UTC (permalink / raw)
To: Hannes Frederic Sowa, netdev, David Miller; +Cc: linux-kernel, Kamala R
The behaviour of blackhole and prohibit routes has been corrected by setting
the input and output pointers of the dst variable appropriately. For
blackhole routes, they are set to dst_discard and to ip6_pkt_discard and
ip6_pkt_discard_out respectively for prohibit routes.
ipv6: ip6_pkt_prohibit(_out) should not depend on
CONFIG_IPV6_MULTIPLE_TABLES
We need ip6_pkt_prohibit(_out) available without
CONFIG_IPV6_MULTIPLE_TABLES
Signed-off-by: Kamala R <kamala@aristanetworks.com>
---
net/ipv6/route.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 7faa9d5..ddb9d41 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -84,6 +84,8 @@ static int ip6_dst_gc(struct dst_ops *ops);
static int ip6_pkt_discard(struct sk_buff *skb);
static int ip6_pkt_discard_out(struct sk_buff *skb);
+static int ip6_pkt_prohibit(struct sk_buff *skb);
+static int ip6_pkt_prohibit_out(struct sk_buff *skb);
static void ip6_link_failure(struct sk_buff *skb);
static void ip6_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,
struct sk_buff *skb, u32 mtu);
@@ -234,9 +236,6 @@ static const struct rt6_info ip6_null_entry_template = {
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
-static int ip6_pkt_prohibit(struct sk_buff *skb);
-static int ip6_pkt_prohibit_out(struct sk_buff *skb);
-
static const struct rt6_info ip6_prohibit_entry_template = {
.dst = {
.__refcnt = ATOMIC_INIT(1),
@@ -1565,21 +1564,24 @@ int ip6_route_add(struct fib6_config *cfg)
goto out;
}
}
- rt->dst.output = ip6_pkt_discard_out;
- rt->dst.input = ip6_pkt_discard;
rt->rt6i_flags = RTF_REJECT|RTF_NONEXTHOP;
switch (cfg->fc_type) {
case RTN_BLACKHOLE:
rt->dst.error = -EINVAL;
+ rt->dst.output = dst_discard;
+ rt->dst.input = dst_discard;
break;
case RTN_PROHIBIT:
rt->dst.error = -EACCES;
+ rt->dst.output = ip6_pkt_prohibit_out;
+ rt->dst.input = ip6_pkt_prohibit;
break;
case RTN_THROW:
- rt->dst.error = -EAGAIN;
- break;
default:
- rt->dst.error = -ENETUNREACH;
+ rt->dst.error = (cfg->fc_type == RTN_THROW) ? -EAGAIN
+ : -ENETUNREACH;
+ rt->dst.output = ip6_pkt_discard_out;
+ rt->dst.input = ip6_pkt_discard;
break;
}
goto install_route;
@@ -2144,8 +2146,6 @@ static int ip6_pkt_discard_out(struct sk_buff *skb)
return ip6_pkt_drop(skb, ICMPV6_NOROUTE, IPSTATS_MIB_OUTNOROUTES);
}
-#ifdef CONFIG_IPV6_MULTIPLE_TABLES
-
static int ip6_pkt_prohibit(struct sk_buff *skb)
{
return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_INNOROUTES);
@@ -2157,8 +2157,6 @@ static int ip6_pkt_prohibit_out(struct sk_buff *skb)
return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES);
}
-#endif
-
/*
* Allocate a dst for local (unicast / anycast) address.
*/
--
1.7.9.5
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch v4] IPv6: Fixed support for blackhole and prohibit routes
2013-12-02 14:25 [Patch v4] IPv6: Fixed support for blackhole and prohibit routes Kamala R
@ 2013-12-02 15:34 ` Hannes Frederic Sowa
2013-12-02 22:16 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Hannes Frederic Sowa @ 2013-12-02 15:34 UTC (permalink / raw)
To: Kamala R; +Cc: netdev, David Miller, linux-kernel
On Mon, Dec 02, 2013 at 07:55:21PM +0530, Kamala R wrote:
> The behaviour of blackhole and prohibit routes has been corrected by setting
> the input and output pointers of the dst variable appropriately. For
> blackhole routes, they are set to dst_discard and to ip6_pkt_discard and
> ip6_pkt_discard_out respectively for prohibit routes.
>
> ipv6: ip6_pkt_prohibit(_out) should not depend on
> CONFIG_IPV6_MULTIPLE_TABLES
>
> We need ip6_pkt_prohibit(_out) available without
> CONFIG_IPV6_MULTIPLE_TABLES
>
> Signed-off-by: Kamala R <kamala@aristanetworks.com>
Looks good, thanks!
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch v4] IPv6: Fixed support for blackhole and prohibit routes
2013-12-02 14:25 [Patch v4] IPv6: Fixed support for blackhole and prohibit routes Kamala R
2013-12-02 15:34 ` Hannes Frederic Sowa
@ 2013-12-02 22:16 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2013-12-02 22:16 UTC (permalink / raw)
To: kamala; +Cc: hannes, netdev, linux-kernel
From: Kamala R <kamala@aristanetworks.com>
Date: Mon, 2 Dec 2013 19:55:21 +0530
> The behaviour of blackhole and prohibit routes has been corrected by setting
> the input and output pointers of the dst variable appropriately. For
> blackhole routes, they are set to dst_discard and to ip6_pkt_discard and
> ip6_pkt_discard_out respectively for prohibit routes.
>
> ipv6: ip6_pkt_prohibit(_out) should not depend on
> CONFIG_IPV6_MULTIPLE_TABLES
>
> We need ip6_pkt_prohibit(_out) available without
> CONFIG_IPV6_MULTIPLE_TABLES
>
> Signed-off-by: Kamala R <kamala@aristanetworks.com>
Applied and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-12-02 22:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-02 14:25 [Patch v4] IPv6: Fixed support for blackhole and prohibit routes Kamala R
2013-12-02 15:34 ` Hannes Frederic Sowa
2013-12-02 22:16 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®