Skip to contentSkip to conversation

ipv6: judge the accept_ra_defrtr before calling rt6_route_rcv

PATCH Applied Duan Jiong 3 participants 3 messages Nov 26, 2013 – Dec 2, 2013

Subsystems (3)
lore
Share & tools
lore

Duan Jiong

author
#0 lore raw

PATCH 1/1 ipv6: judge the accept_ra_defrtr before calling rt6_route_rcv

when dealing with a RA message, if accept_ra_defrtr is false, the kernel will not add the default route, and then deal with the following route information options. Unfortunately, those options maybe contain default route, so let's judge the accept_ra_defrtr before calling rt6_route_rcv.

---
 net/ipv6/ndisc.c | 3 +++
 1 file changed, 3 insertions(+)
net/ipv6/ndisc.c +3 -0
index 3512177..3008651 100644
@@ -1277,6 +1277,9 @@ skip_linkparms:
 			    ri->prefix_len == 0)
 				continue;
 #endif
+			if (ri->prefix_len == 0 &&
+			    !in6_dev->cnf.accept_ra_defrtr)
+				continue;
 			if (ri->prefix_len > in6_dev->cnf.accept_ra_rt_info_max_plen)
 				continue;
 			rt6_route_rcv(skb->dev, (u8*)p, (p->nd_opt_len) << 3,
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 8 lines · Duan Jiong

when dealing with a RA message, if accept_ra_defrtr is false, the kernel will not add the default route, and then deal with the following route information options. Unfortunately, those options maybe contain default route, so let's judge the accept_ra_defrtr before calling rt6_route_rcv.

I am ambivalent regarding this change.

accept_ra_defrtr protected against adding default routers without routing options and accept_ra_rt_info_max_plen == -1 disables the acceptance of any routing options in router advertisments.

I don't have an idea why we need this distinction altough I once used it for testing. But because this change makes it more understandable for users I am ok with that.

Greetings,

Hannes

maintainer Applied
#2 lore raw

From: Hannes Frederic Sowa <[email protected]>
Date: Fri, 29 Nov 2013 07:09:45 +0100

Quoted 12 lines · Duan Jiong
Quoted 8 lines

when dealing with a RA message, if accept_ra_defrtr is false, the kernel will not add the default route, and then deal with the following route information options. Unfortunately, those options maybe contain default route, so let's judge the accept_ra_defrtr before calling rt6_route_rcv.

I am ambivalent regarding this change.

Quoted 7 lines

accept_ra_defrtr protected against adding default routers without routing options and accept_ra_rt_info_max_plen == -1 disables the acceptance of any routing options in router advertisments.

I don't have an idea why we need this distinction altough I once used it for testing. But because this change makes it more understandable for users I am ok with that.

I've applied this, thanks everyone.