[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ca2f321d1b39928af6c7bc6a2ada60f81b1a1712.1545057865.git.petrm@mellanox.com>
Date: Mon, 17 Dec 2018 14:58:50 +0000
From: Petr Machata <petrm@...lanox.com>
To: "netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC: "davem@...emloft.net" <davem@...emloft.net>,
Ido Schimmel <idosch@...lanox.com>,
"roopa@...ulusnetworks.com" <roopa@...ulusnetworks.com>
Subject: [PATCH net 3/5] vxlan: Don't notify about deletion of non-added
default FDB entry
In __vxlan_dev_create(), one of the steps is to add a default FDB entry.
The default entry is created and added before the device is even
registered, and is likewise not removed until destruction of the device.
(Except when it's removed explicitly.) Consequently, the notification
about this default FDB entry is only sent belatedly, to prevent sending
neighbor notifications before notifications for the corresponding link
itself.
Before the addition notification is sent, the whole procedure can fail
due to an error return from rtnl_configure_link(). That triggers
unregister of the freshly registered device, which causes removal of the
default FDB entry, including deletion notification. However since at
that point the addition notification itself was not yet distributed, it
is incorrect to send deletion notifications.
To fix the issue, allocate a bit at VXLAN device to communicate whether
a notifier should be invoked for the sole FDB entry or not. Set to true
after the notification is sent.
Fixes: 0241b836732f ("vxlan: fix default fdb entry netlink notify ordering during netdev create")
Signed-off-by: Petr Machata <petrm@...lanox.com>
---
drivers/net/vxlan.c | 3 ++-
include/net/vxlan.h | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 139741617b90..c60f1b420d71 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -850,7 +850,7 @@ static void vxlan_fdb_destroy(struct vxlan_dev *vxlan, struct vxlan_fdb *f,
"delete %pM\n", f->eth_addr);
--vxlan->addrcnt;
- if (do_notify)
+ if (do_notify && vxlan->cfg.do_notify)
list_for_each_entry(rd, &f->remotes, list)
vxlan_fdb_notify(vxlan, f, rd, RTM_DELNEIGH);
@@ -3295,6 +3295,7 @@ static int __vxlan_dev_create(struct net *net, struct net_device *dev,
/* notify default fdb entry */
if (f)
vxlan_fdb_notify(vxlan, f, first_remote_rtnl(f), RTM_NEWNEIGH);
+ vxlan->cfg.do_notify = true;
list_add(&vxlan->next, &vn->vxlan_list);
return 0;
diff --git a/include/net/vxlan.h b/include/net/vxlan.h
index 03431c148e16..5932f89bd932 100644
--- a/include/net/vxlan.h
+++ b/include/net/vxlan.h
@@ -216,6 +216,7 @@ struct vxlan_config {
unsigned long age_interval;
unsigned int addrmax;
bool no_share;
+ u8 do_notify:1;
};
struct vxlan_dev_node {
--
2.4.11
Powered by blists - more mailing lists