Skip to contentSkip to conversation

IPv6: Fixed support for blackhole and prohibit routes

PATCH Superseded Kamala R 3 participants 8 messages Nov 28, 2013 – Dec 2, 2013

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Kamala R

author
#0 lore raw

PATCH v3 1/1 IPv6: Fixed support for blackhole and prohibit routes

From: Kamala R <[email protected]>

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.

---
 net/ipv6/route.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
net/ipv6/route.c +8 -5
index 7faa9d5..97125c4 100644
@@ -1565,21 +1565,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;
Signature · 1 line
1.7.9.5
Acked-by on v3 1/1
#1 lore raw
Quoted 8 lines · Kamala R

From: Kamala R <[email protected]>

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.

Thanks for changing this once again!

#2 lore raw

PATCH 1/1 ipv6: ip6_pkt_prohibit(_out) should not depend on CONFIG_IPV6_MULTIPLE_TABLES

In reply to Kamala R

Since patch "IPv6: Fixed support for blackhole and prohibit routes" we need ip6_pkt_prohibit(_out) available without CONFIG_IPV6_MULTIPLE_TABLES defined.

---
 net/ipv6/route.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
net/ipv6/route.c +2 -7
index 97125c4..ddb9d41 100644
@@ -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),
@@ -2147,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);
@@ -2160,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.
  */
Signature · 1 line
1.8.3.1
maintainer
#3 lore raw

Re: [PATCH] ipv6: ip6_pkt_prohibit(_out) should not depend on CONFIG_IPV6_MULTIPLE_TABLES

From: Hannes Frederic Sowa <[email protected]>
Date: Thu, 28 Nov 2013 20:04:11 +0100

Quoted 6 lines

Since patch "IPv6: Fixed support for blackhole and prohibit routes" we need ip6_pkt_prohibit(_out) available without CONFIG_IPV6_MULTIPLE_TABLES defined.

Please reference the SHA1 ID of the change as well as it's commit header text, thank you.

#4 lore raw

Re: [PATCH] ipv6: ip6_pkt_prohibit(_out) should not depend on CONFIG_IPV6_MULTIPLE_TABLES

Quoted 7 lines · David Miller

From: Hannes Frederic Sowa <[email protected]>
Date: Thu, 28 Nov 2013 20:04:11 +0100

Quoted 4 lines

Since patch "IPv6: Fixed support for blackhole and prohibit routes" we need ip6_pkt_prohibit(_out) available without CONFIG_IPV6_MULTIPLE_TABLES defined.

Quoted 5 lines
Quoted 2 lines

Please reference the SHA1 ID of the change as well as it's commit header text, thank you.

This patch is a follow-up patch for the first one in this thread which is not committed, yet. Either Kamala can squash them into one or I'll repost it later.

Greetings,

Hannes

maintainer
#5 lore raw

Re: [PATCH] ipv6: ip6_pkt_prohibit(_out) should not depend on CONFIG_IPV6_MULTIPLE_TABLES

From: Hannes Frederic Sowa <[email protected]>
Date: Sat, 30 Nov 2013 18:46:35 +0100

Quoted 11 lines · David Miller
Quoted 10 lines

From: Hannes Frederic Sowa <[email protected]>
Date: Thu, 28 Nov 2013 20:04:11 +0100

Quoted 6 lines

Since patch "IPv6: Fixed support for blackhole and prohibit routes" we need ip6_pkt_prohibit(_out) available without CONFIG_IPV6_MULTIPLE_TABLES defined.

Quoted 6 lines
Quoted 2 lines

Please reference the SHA1 ID of the change as well as it's commit header text, thank you.

This patch is a follow-up patch for the first one in this thread which is not committed, yet. Either Kamala can squash them into one or I'll repost it later.

I think they need to be combined, otherwise bisection is broken.

#6 lore raw

Re: [PATCH] ipv6: ip6_pkt_prohibit(_out) should not depend on CONFIG_IPV6_MULTIPLE_TABLES

Quoted 14 lines · David Miller

From: Hannes Frederic Sowa <[email protected]>
Date: Sat, 30 Nov 2013 18:46:35 +0100

Quoted 11 lines · David Miller
Quoted 10 lines

From: Hannes Frederic Sowa <[email protected]>
Date: Thu, 28 Nov 2013 20:04:11 +0100

Quoted 6 lines

Since patch "IPv6: Fixed support for blackhole and prohibit routes" we need ip6_pkt_prohibit(_out) available without CONFIG_IPV6_MULTIPLE_TABLES defined.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Please reference the SHA1 ID of the change as well as it's commit header text, thank you.

This patch is a follow-up patch for the first one in this thread which is not committed, yet. Either Kamala can squash them into one or I'll repost it later.

I think they need to be combined, otherwise bisection is broken.

Kamala, as your patch is the main one, can you squash my patch into yours?

author
#7 lore raw

Re: [PATCH] ipv6: ip6_pkt_prohibit(_out) should not depend on CONFIG_IPV6_MULTIPLE_TABLES

Hi,

I have submitted a version 4 of my patch that squashes the above changes into it as well. Is that the right way to do it ?

Regards,
Kamala

Quoted 26 lines · Hannes Frederic Sowa
Quoted 14 lines · David Miller

From: Hannes Frederic Sowa <[email protected]>
Date: Sat, 30 Nov 2013 18:46:35 +0100

Quoted 11 lines · David Miller
Quoted 10 lines

From: Hannes Frederic Sowa <[email protected]>
Date: Thu, 28 Nov 2013 20:04:11 +0100

Quoted 6 lines

Since patch "IPv6: Fixed support for blackhole and prohibit routes" we need ip6_pkt_prohibit(_out) available without CONFIG_IPV6_MULTIPLE_TABLES defined.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Please reference the SHA1 ID of the change as well as it's commit header text, thank you.

This patch is a follow-up patch for the first one in this thread which is not committed, yet. Either Kamala can squash them into one or I'll repost it later.

I think they need to be combined, otherwise bisection is broken.

Kamala, as your patch is the main one, can you squash my patch into yours?