Skip to contentSkip to conversation

ipv6: fix the check when handle RA

RFC PATCH In review [email protected] 2 participants 2 messages Jul 10, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 ipv6: fix the check when handle RA

From: Li RongQing <[email protected]>

d9333196572(ipv6: Allow accepting RA from local IP addresses.) made ndisc_router_discovery to skip to handle RA when accept_ra_from_local is 0 and saddr of packet is not the device address, in fact, this condition should be handled

Fixes d9333196572(ipv6: Allow accepting RA from local IP addresses.)
Cc Ben Greear <[email protected]>
---
 net/ipv6/ndisc.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
net/ipv6/ndisc.c +4 -4
index a845e3d..e70e805 100644
@@ -1152,8 +1152,8 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 	 * accept_ra_from_local is set to true.
 	 */
 	if (!(in6_dev->cnf.accept_ra_from_local ||
-	      ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr,
-			    NULL, 0))) {
+	      !ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr,
+			     NULL, 0))) {
 		ND_PRINTK(2, info,
 			  "RA from local address detected on dev: %s: default router ignored\n",
 			  skb->dev->name);
@@ -1295,8 +1295,8 @@ skip_linkparms:
 
 #ifdef CONFIG_IPV6_ROUTE_INFO
 	if (!(in6_dev->cnf.accept_ra_from_local ||
-	      ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr,
-			    NULL, 0))) {
+	      !ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr,
+			     NULL, 0))) {
 		ND_PRINTK(2, info,
 			  "RA from local address detected on dev: %s: router info ignored.\n",
 			  skb->dev->name);
Signature · 1 line
1.7.10.4
#1 lore raw

Hi,

Quoted 18 lines · On Do, 2014-07-10 at 16:29 +0800, [email protected] wrote:

From: Li RongQing <[email protected]>

d9333196572(ipv6: Allow accepting RA from local IP addresses.) made ndisc_router_discovery to skip to handle RA when accept_ra_from_local is 0 and saddr of packet is not the device address, in fact, this condition should be handled

Fixes d9333196572(ipv6: Allow accepting RA from local IP addresses.)
Cc Ben Greear <[email protected]>
 net/ipv6/ndisc.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
net/ipv6/ndisc.c +0 -0
index a845e3d..e70e805 100644

net/ipv6/ndisc.c static void ndisc_router_discovery(struct sk_buff *skb) · line 1156

Quoted 7 lines
net/ipv6/ndisc.c +2 -2
@@ -1152,8 +1152,8 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 	 * accept_ra_from_local is set to true.
 	 */
 	if (!(in6_dev->cnf.accept_ra_from_local ||
-	      ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr,
-			    NULL, 0))) {
+	      !ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr,
+			     NULL, 0))) {

Uh!

Instead of double negotiation can you please write

if (!in6_dev->cnf.accept_ra_from_local &&

    ipv6_chk_addr(...)) {
	printk(...);
	goto skip;
}

Thanks for fixing this, good catch!

Thanks,
Hannes