ipv6: judge the accept_ra_defrtr before calling rt6_route_rcv
Subsystems (3)
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
@@ -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
Quoted 8 lines · Duan Jiong
when dealing with a RA message, if
accept_ra_defrtris 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 theaccept_ra_defrtrbefore callingrt6_route_rcv.Signed-off-by Duan Jiong <[email protected]>
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
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_defrtris 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 theaccept_ra_defrtrbefore callingrt6_route_rcv.Signed-off-by Duan Jiong <[email protected]>I am ambivalent regarding this change.
Quoted 7 lines
accept_ra_defrtrprotected against adding default routers without routing options andaccept_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.