summaryrefslogtreecommitdiffstats
path: root/drivers/net/vxlan.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/vxlan.c')
-rw-r--r--drivers/net/vxlan.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 297cdeaef479..0565f8880199 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -568,6 +568,7 @@ static int vxlan_fdb_replace(struct vxlan_fdb *f,
568 rd->remote_port = port; 568 rd->remote_port = port;
569 rd->remote_vni = vni; 569 rd->remote_vni = vni;
570 rd->remote_ifindex = ifindex; 570 rd->remote_ifindex = ifindex;
571 rd->offloaded = false;
571 return 1; 572 return 1;
572} 573}
573 574
@@ -3258,6 +3259,7 @@ static int __vxlan_dev_create(struct net *net, struct net_device *dev,
3258 struct vxlan_net *vn = net_generic(net, vxlan_net_id); 3259 struct vxlan_net *vn = net_generic(net, vxlan_net_id);
3259 struct vxlan_dev *vxlan = netdev_priv(dev); 3260 struct vxlan_dev *vxlan = netdev_priv(dev);
3260 struct vxlan_fdb *f = NULL; 3261 struct vxlan_fdb *f = NULL;
3262 bool unregister = false;
3261 int err; 3263 int err;
3262 3264
3263 err = vxlan_dev_configure(net, dev, conf, false, extack); 3265 err = vxlan_dev_configure(net, dev, conf, false, extack);
@@ -3283,12 +3285,11 @@ static int __vxlan_dev_create(struct net *net, struct net_device *dev,
3283 err = register_netdevice(dev); 3285 err = register_netdevice(dev);
3284 if (err) 3286 if (err)
3285 goto errout; 3287 goto errout;
3288 unregister = true;
3286 3289
3287 err = rtnl_configure_link(dev, NULL); 3290 err = rtnl_configure_link(dev, NULL);
3288 if (err) { 3291 if (err)
3289 unregister_netdevice(dev);
3290 goto errout; 3292 goto errout;
3291 }
3292 3293
3293 /* notify default fdb entry */ 3294 /* notify default fdb entry */
3294 if (f) 3295 if (f)
@@ -3296,9 +3297,16 @@ static int __vxlan_dev_create(struct net *net, struct net_device *dev,
3296 3297
3297 list_add(&vxlan->next, &vn->vxlan_list); 3298 list_add(&vxlan->next, &vn->vxlan_list);
3298 return 0; 3299 return 0;
3300
3299errout: 3301errout:
3302 /* unregister_netdevice() destroys the default FDB entry with deletion
3303 * notification. But the addition notification was not sent yet, so
3304 * destroy the entry by hand here.
3305 */
3300 if (f) 3306 if (f)
3301 vxlan_fdb_destroy(vxlan, f, false); 3307 vxlan_fdb_destroy(vxlan, f, false);
3308 if (unregister)
3309 unregister_netdevice(dev);
3302 return err; 3310 return err;
3303} 3311}
3304 3312
@@ -3534,7 +3542,6 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[],
3534 struct vxlan_rdst *dst = &vxlan->default_dst; 3542 struct vxlan_rdst *dst = &vxlan->default_dst;
3535 struct vxlan_rdst old_dst; 3543 struct vxlan_rdst old_dst;
3536 struct vxlan_config conf; 3544 struct vxlan_config conf;
3537 struct vxlan_fdb *f = NULL;
3538 int err; 3545 int err;
3539 3546
3540 err = vxlan_nl2conf(tb, data, 3547 err = vxlan_nl2conf(tb, data,
@@ -3560,19 +3567,19 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[],
3560 old_dst.remote_ifindex, 0); 3567 old_dst.remote_ifindex, 0);
3561 3568
3562 if (!vxlan_addr_any(&dst->remote_ip)) { 3569 if (!vxlan_addr_any(&dst->remote_ip)) {
3563 err = vxlan_fdb_create(vxlan, all_zeros_mac, 3570 err = vxlan_fdb_update(vxlan, all_zeros_mac,
3564 &dst->remote_ip, 3571 &dst->remote_ip,
3565 NUD_REACHABLE | NUD_PERMANENT, 3572 NUD_REACHABLE | NUD_PERMANENT,
3573 NLM_F_APPEND | NLM_F_CREATE,
3566 vxlan->cfg.dst_port, 3574 vxlan->cfg.dst_port,
3567 dst->remote_vni, 3575 dst->remote_vni,
3568 dst->remote_vni, 3576 dst->remote_vni,
3569 dst->remote_ifindex, 3577 dst->remote_ifindex,
3570 NTF_SELF, &f); 3578 NTF_SELF);
3571 if (err) { 3579 if (err) {
3572 spin_unlock_bh(&vxlan->hash_lock); 3580 spin_unlock_bh(&vxlan->hash_lock);
3573 return err; 3581 return err;
3574 } 3582 }
3575 vxlan_fdb_notify(vxlan, f, first_remote_rtnl(f), RTM_NEWNEIGH);
3576 } 3583 }
3577 spin_unlock_bh(&vxlan->hash_lock); 3584 spin_unlock_bh(&vxlan->hash_lock);
3578 } 3585 }