diff mbox

ipv6: send only one NEWLINK when RA causes changes

Message ID 20150831235706.GA17924@suse.de
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Marius Tomaschewski Aug. 31, 2015, 11:57 p.m. UTC
Signed-off-by: Marius Tomaschewski <mt@suse.de>

Comments

David Miller Sept. 1, 2015, 4:23 a.m. UTC | #1
From: Marius Tomaschewski <mt@suse.de>
Date: Tue, 1 Sep 2015 01:57:30 +0200

> Signed-off-by: Marius Tomaschewski <mt@suse.de>

Applied, thanks.

I wonder what to do about the situations right before the first
assignment of send_ifinfo_notify to true where the dst_neigh_lookup()
fails.

Since we updated if_flags, we probably should still emit the
notification.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 99ea9dd..8456c75 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1075,6 +1075,7 @@  static void ndisc_router_discovery(struct sk_buff *skb)
 	int optlen;
 	unsigned int pref = 0;
 	__u32 old_if_flags;
+	bool send_ifinfo_notify = false;
 
 	__u8 *opt = (__u8 *)(ra_msg + 1);
 
@@ -1154,7 +1155,7 @@  static void ndisc_router_discovery(struct sk_buff *skb)
 					IF_RA_OTHERCONF : 0);
 
 	if (old_if_flags != in6_dev->if_flags)
-		inet6_ifinfo_notify(RTM_NEWLINK, in6_dev);
+		send_ifinfo_notify = true;
 
 	if (!in6_dev->cnf.accept_ra_defrtr) {
 		ND_PRINTK(2, info,
@@ -1259,7 +1260,7 @@  skip_defrtr:
 				rtime = HZ/10;
 			NEIGH_VAR_SET(in6_dev->nd_parms, RETRANS_TIME, rtime);
 			in6_dev->tstamp = jiffies;
-			inet6_ifinfo_notify(RTM_NEWLINK, in6_dev);
+			send_ifinfo_notify = true;
 		}
 
 		rtime = ntohl(ra_msg->reachable_time);
@@ -1276,11 +1277,17 @@  skip_defrtr:
 					      GC_STALETIME, 3 * rtime);
 				in6_dev->nd_parms->reachable_time = neigh_rand_reach_time(rtime);
 				in6_dev->tstamp = jiffies;
-				inet6_ifinfo_notify(RTM_NEWLINK, in6_dev);
+				send_ifinfo_notify = true;
 			}
 		}
 	}
 
+	/*
+	 *	Send a notify if RA changed managed/otherconf flags or timer settings
+	 */
+	if (send_ifinfo_notify)
+		inet6_ifinfo_notify(RTM_NEWLINK, in6_dev);
+
 skip_linkparms:
 
 	/*