aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLorenzo Bianconi <lorenzo.bianconi@redhat.com>2018-04-17 05:54:39 -0400
committerDavid S. Miller <davem@davemloft.net>2018-04-17 14:03:56 -0400
commita2d481b326c98b6b67eea8a378c858d57ca5ff3d (patch)
tree3622d9d504f9667698826c8d8fb579bba05eacdd
parenta64dcddc5cdfbf1d4d0af519c30cd6c2e4828282 (diff)
ipv6: send netlink notifications for manually configured addresses
Send a netlink notification when userspace adds a manually configured address if DAD is enabled and optimistic flag isn't set. Moreover send RTM_DELADDR notifications for tentative addresses. Some userspace applications (e.g. NetworkManager) are interested in addr netlink events albeit the address is still in tentative state, however events are not sent if DAD process is not completed. If the address is added and immediately removed userspace listeners are not notified. This behaviour can be easily reproduced by using veth interfaces: $ ip -b - <<EOF > link add dev vm1 type veth peer name vm2 > link set dev vm1 up > link set dev vm2 up > addr add 2001:db8:a:b:1:2:3:4/64 dev vm1 > addr del 2001:db8:a:b:1:2:3:4/64 dev vm1 EOF This patch reverts the behaviour introduced by the commit f784ad3d79e5 ("ipv6: do not send RTM_DELADDR for tentative addresses") Suggested-by: Thomas Haller <thaller@redhat.com> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv6/addrconf.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 62b97722722c..b2c0175125db 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2901,6 +2901,11 @@ static int inet6_addr_add(struct net *net, int ifindex,
2901 expires, flags); 2901 expires, flags);
2902 } 2902 }
2903 2903
2904 /* Send a netlink notification if DAD is enabled and
2905 * optimistic flag is not set
2906 */
2907 if (!(ifp->flags & (IFA_F_OPTIMISTIC | IFA_F_NODAD)))
2908 ipv6_ifa_notify(0, ifp);
2904 /* 2909 /*
2905 * Note that section 3.1 of RFC 4429 indicates 2910 * Note that section 3.1 of RFC 4429 indicates
2906 * that the Optimistic flag should not be set for 2911 * that the Optimistic flag should not be set for
@@ -5028,14 +5033,6 @@ static void inet6_ifa_notify(int event, struct inet6_ifaddr *ifa)
5028 struct net *net = dev_net(ifa->idev->dev); 5033 struct net *net = dev_net(ifa->idev->dev);
5029 int err = -ENOBUFS; 5034 int err = -ENOBUFS;
5030 5035
5031 /* Don't send DELADDR notification for TENTATIVE address,
5032 * since NEWADDR notification is sent only after removing
5033 * TENTATIVE flag, if DAD has not failed.
5034 */
5035 if (ifa->flags & IFA_F_TENTATIVE && !(ifa->flags & IFA_F_DADFAILED) &&
5036 event == RTM_DELADDR)
5037 return;
5038
5039 skb = nlmsg_new(inet6_ifaddr_msgsize(), GFP_ATOMIC); 5036 skb = nlmsg_new(inet6_ifaddr_msgsize(), GFP_ATOMIC);
5040 if (!skb) 5037 if (!skb)
5041 goto errout; 5038 goto errout;