mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
vxlan: fix ovs support
The required changes in the function vxlan_dev_create() were missing in commit8bcdc4f3a2
. The vxlan device is not registered anymore after this patch and the error path causes an stack dump: WARNING: CPU: 3 PID: 1498 at net/core/dev.c:6713 rollback_registered_many+0x9d/0x3f0 Fixes:8bcdc4f3a2
("vxlan: add changelink support") CC: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
91864f5852
commit
c80498e36d
1 changed files with 40 additions and 33 deletions
|
@ -2976,6 +2976,44 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int __vxlan_dev_create(struct net *net, struct net_device *dev,
|
||||||
|
struct vxlan_config *conf)
|
||||||
|
{
|
||||||
|
struct vxlan_net *vn = net_generic(net, vxlan_net_id);
|
||||||
|
struct vxlan_dev *vxlan = netdev_priv(dev);
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = vxlan_dev_configure(net, dev, conf, false);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
dev->ethtool_ops = &vxlan_ethtool_ops;
|
||||||
|
|
||||||
|
/* create an fdb entry for a valid default destination */
|
||||||
|
if (!vxlan_addr_any(&vxlan->default_dst.remote_ip)) {
|
||||||
|
err = vxlan_fdb_create(vxlan, all_zeros_mac,
|
||||||
|
&vxlan->default_dst.remote_ip,
|
||||||
|
NUD_REACHABLE | NUD_PERMANENT,
|
||||||
|
NLM_F_EXCL | NLM_F_CREATE,
|
||||||
|
vxlan->cfg.dst_port,
|
||||||
|
vxlan->default_dst.remote_vni,
|
||||||
|
vxlan->default_dst.remote_vni,
|
||||||
|
vxlan->default_dst.remote_ifindex,
|
||||||
|
NTF_SELF);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = register_netdevice(dev);
|
||||||
|
if (err) {
|
||||||
|
vxlan_fdb_delete_default(vxlan, vxlan->default_dst.remote_vni);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
list_add(&vxlan->next, &vn->vxlan_list);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int vxlan_nl2conf(struct nlattr *tb[], struct nlattr *data[],
|
static int vxlan_nl2conf(struct nlattr *tb[], struct nlattr *data[],
|
||||||
struct net_device *dev, struct vxlan_config *conf,
|
struct net_device *dev, struct vxlan_config *conf,
|
||||||
bool changelink)
|
bool changelink)
|
||||||
|
@ -3172,8 +3210,6 @@ static int vxlan_nl2conf(struct nlattr *tb[], struct nlattr *data[],
|
||||||
static int vxlan_newlink(struct net *src_net, struct net_device *dev,
|
static int vxlan_newlink(struct net *src_net, struct net_device *dev,
|
||||||
struct nlattr *tb[], struct nlattr *data[])
|
struct nlattr *tb[], struct nlattr *data[])
|
||||||
{
|
{
|
||||||
struct vxlan_net *vn = net_generic(src_net, vxlan_net_id);
|
|
||||||
struct vxlan_dev *vxlan = netdev_priv(dev);
|
|
||||||
struct vxlan_config conf;
|
struct vxlan_config conf;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
@ -3181,36 +3217,7 @@ static int vxlan_newlink(struct net *src_net, struct net_device *dev,
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
err = vxlan_dev_configure(src_net, dev, &conf, false);
|
return __vxlan_dev_create(src_net, dev, &conf);
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
|
|
||||||
dev->ethtool_ops = &vxlan_ethtool_ops;
|
|
||||||
|
|
||||||
/* create an fdb entry for a valid default destination */
|
|
||||||
if (!vxlan_addr_any(&vxlan->default_dst.remote_ip)) {
|
|
||||||
err = vxlan_fdb_create(vxlan, all_zeros_mac,
|
|
||||||
&vxlan->default_dst.remote_ip,
|
|
||||||
NUD_REACHABLE | NUD_PERMANENT,
|
|
||||||
NLM_F_EXCL | NLM_F_CREATE,
|
|
||||||
vxlan->cfg.dst_port,
|
|
||||||
vxlan->default_dst.remote_vni,
|
|
||||||
vxlan->default_dst.remote_vni,
|
|
||||||
vxlan->default_dst.remote_ifindex,
|
|
||||||
NTF_SELF);
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = register_netdevice(dev);
|
|
||||||
if (err) {
|
|
||||||
vxlan_fdb_delete_default(vxlan, vxlan->default_dst.remote_vni);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
list_add(&vxlan->next, &vn->vxlan_list);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[],
|
static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[],
|
||||||
|
@ -3440,7 +3447,7 @@ struct net_device *vxlan_dev_create(struct net *net, const char *name,
|
||||||
if (IS_ERR(dev))
|
if (IS_ERR(dev))
|
||||||
return dev;
|
return dev;
|
||||||
|
|
||||||
err = vxlan_dev_configure(net, dev, conf, false);
|
err = __vxlan_dev_create(net, dev, conf);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
free_netdev(dev);
|
free_netdev(dev);
|
||||||
return ERR_PTR(err);
|
return ERR_PTR(err);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue