Skip to content

Commit

Permalink
Merge branch 'ovs-notifications'
Browse files Browse the repository at this point in the history
Nicolas Dichtel says:

====================
ovs: fix rtnl notifications on interface deletion

There was no rtnl notifications for interfaces (gre, vxlan, geneve) created
by ovs. This problem is fixed by adjusting the creation path.

v1 -> v2:
 - add patch #1 and #4
 - rework error handling in patch #2
====================

Acked-by: Pravin B Shelar <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
davem330 committed Jun 15, 2016
2 parents d1e3728 + 4100948 commit 61e0979
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 30 deletions.
14 changes: 11 additions & 3 deletions drivers/net/geneve.c
Original file line number Diff line number Diff line change
Expand Up @@ -1508,6 +1508,7 @@ struct net_device *geneve_dev_create_fb(struct net *net, const char *name,
{
struct nlattr *tb[IFLA_MAX + 1];
struct net_device *dev;
LIST_HEAD(list_kill);
int err;

memset(tb, 0, sizeof(tb));
Expand All @@ -1519,8 +1520,10 @@ struct net_device *geneve_dev_create_fb(struct net *net, const char *name,
err = geneve_configure(net, dev, &geneve_remote_unspec,
0, 0, 0, 0, htons(dst_port), true,
GENEVE_F_UDP_ZERO_CSUM6_RX);
if (err)
goto err;
if (err) {
free_netdev(dev);
return ERR_PTR(err);
}

/* openvswitch users expect packet sizes to be unrestricted,
* so set the largest MTU we can.
Expand All @@ -1529,10 +1532,15 @@ struct net_device *geneve_dev_create_fb(struct net *net, const char *name,
if (err)
goto err;

err = rtnl_configure_link(dev, NULL);
if (err < 0)
goto err;

return dev;

err:
free_netdev(dev);
geneve_dellink(dev, &list_kill);
unregister_netdevice_many(&list_kill);
return ERR_PTR(err);
}
EXPORT_SYMBOL_GPL(geneve_dev_create_fb);
Expand Down
58 changes: 34 additions & 24 deletions drivers/net/vxlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -2952,30 +2952,6 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev,
return 0;
}

struct net_device *vxlan_dev_create(struct net *net, const char *name,
u8 name_assign_type, struct vxlan_config *conf)
{
struct nlattr *tb[IFLA_MAX+1];
struct net_device *dev;
int err;

memset(&tb, 0, sizeof(tb));

dev = rtnl_create_link(net, name, name_assign_type,
&vxlan_link_ops, tb);
if (IS_ERR(dev))
return dev;

err = vxlan_dev_configure(net, dev, conf);
if (err < 0) {
free_netdev(dev);
return ERR_PTR(err);
}

return dev;
}
EXPORT_SYMBOL_GPL(vxlan_dev_create);

static int vxlan_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[])
{
Expand Down Expand Up @@ -3268,6 +3244,40 @@ static struct rtnl_link_ops vxlan_link_ops __read_mostly = {
.get_link_net = vxlan_get_link_net,
};

struct net_device *vxlan_dev_create(struct net *net, const char *name,
u8 name_assign_type,
struct vxlan_config *conf)
{
struct nlattr *tb[IFLA_MAX + 1];
struct net_device *dev;
int err;

memset(&tb, 0, sizeof(tb));

dev = rtnl_create_link(net, name, name_assign_type,
&vxlan_link_ops, tb);
if (IS_ERR(dev))
return dev;

err = vxlan_dev_configure(net, dev, conf);
if (err < 0) {
free_netdev(dev);
return ERR_PTR(err);
}

err = rtnl_configure_link(dev, NULL);
if (err < 0) {
LIST_HEAD(list_kill);

vxlan_dellink(dev, &list_kill);
unregister_netdevice_many(&list_kill);
return ERR_PTR(err);
}

return dev;
}
EXPORT_SYMBOL_GPL(vxlan_dev_create);

static void vxlan_handle_lowerdev_unregister(struct vxlan_net *vn,
struct net_device *dev)
{
Expand Down
14 changes: 11 additions & 3 deletions net/ipv4/ip_gre.c
Original file line number Diff line number Diff line change
Expand Up @@ -1121,6 +1121,7 @@ struct net_device *gretap_fb_dev_create(struct net *net, const char *name,
{
struct nlattr *tb[IFLA_MAX + 1];
struct net_device *dev;
LIST_HEAD(list_kill);
struct ip_tunnel *t;
int err;

Expand All @@ -1136,8 +1137,10 @@ struct net_device *gretap_fb_dev_create(struct net *net, const char *name,
t->collect_md = true;

err = ipgre_newlink(net, dev, tb, NULL);
if (err < 0)
goto out;
if (err < 0) {
free_netdev(dev);
return ERR_PTR(err);
}

/* openvswitch users expect packet sizes to be unrestricted,
* so set the largest MTU we can.
Expand All @@ -1146,9 +1149,14 @@ struct net_device *gretap_fb_dev_create(struct net *net, const char *name,
if (err)
goto out;

err = rtnl_configure_link(dev, NULL);
if (err < 0)
goto out;

return dev;
out:
free_netdev(dev);
ip_tunnel_dellink(dev, &list_kill);
unregister_netdevice_many(&list_kill);
return ERR_PTR(err);
}
EXPORT_SYMBOL_GPL(gretap_fb_dev_create);
Expand Down

0 comments on commit 61e0979

Please sign in to comment.