Skip to content

Commit

Permalink
vxlan: don't flush static fdb entries on admin down
Browse files Browse the repository at this point in the history
This patch skips flushing static fdb entries in
ndo_stop, but flushes all fdb entries during vxlan
device delete. This is consistent with the bridge
driver fdb

Signed-off-by: Roopa Prabhu <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
roopa-prabhu authored and davem330 committed Jan 24, 2017
1 parent a824d0b commit 8b3f933
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/net/vxlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -2354,7 +2354,7 @@ static int vxlan_open(struct net_device *dev)
}

/* Purge the forwarding table */
static void vxlan_flush(struct vxlan_dev *vxlan)
static void vxlan_flush(struct vxlan_dev *vxlan, bool do_all)
{
unsigned int h;

Expand All @@ -2364,6 +2364,8 @@ static void vxlan_flush(struct vxlan_dev *vxlan)
hlist_for_each_safe(p, n, &vxlan->fdb_head[h]) {
struct vxlan_fdb *f
= container_of(p, struct vxlan_fdb, hlist);
if (!do_all && (f->state & (NUD_PERMANENT | NUD_NOARP)))
continue;
/* the all_zeros_mac entry is deleted at vxlan_uninit */
if (!is_zero_ether_addr(f->eth_addr))
vxlan_fdb_destroy(vxlan, f);
Expand All @@ -2385,7 +2387,7 @@ static int vxlan_stop(struct net_device *dev)

del_timer_sync(&vxlan->age_timer);

vxlan_flush(vxlan);
vxlan_flush(vxlan, false);
vxlan_sock_release(vxlan);

return ret;
Expand Down Expand Up @@ -3058,6 +3060,8 @@ static void vxlan_dellink(struct net_device *dev, struct list_head *head)
struct vxlan_dev *vxlan = netdev_priv(dev);
struct vxlan_net *vn = net_generic(vxlan->net, vxlan_net_id);

vxlan_flush(vxlan, true);

spin_lock(&vn->sock_lock);
if (!hlist_unhashed(&vxlan->hlist))
hlist_del_rcu(&vxlan->hlist);
Expand Down

0 comments on commit 8b3f933

Please sign in to comment.