Commit 6c8c4446 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

Revert: veth: remove unneeded ifname code from veth_newlink()

84c49d8c ("veth: remove unneeded
ifname code from veth_newlink()") caused regression on veth
creation. This patch reverts the original one.
Reported-by: default avatarMichał Mirosław <mirqus@gmail.com>
Signed-off-by: default avatarJiri Pirko <jpirko@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d9460920
...@@ -403,6 +403,17 @@ static int veth_newlink(struct net *src_net, struct net_device *dev, ...@@ -403,6 +403,17 @@ static int veth_newlink(struct net *src_net, struct net_device *dev,
if (tb[IFLA_ADDRESS] == NULL) if (tb[IFLA_ADDRESS] == NULL)
random_ether_addr(dev->dev_addr); random_ether_addr(dev->dev_addr);
if (tb[IFLA_IFNAME])
nla_strlcpy(dev->name, tb[IFLA_IFNAME], IFNAMSIZ);
else
snprintf(dev->name, IFNAMSIZ, DRV_NAME "%%d");
if (strchr(dev->name, '%')) {
err = dev_alloc_name(dev, dev->name);
if (err < 0)
goto err_alloc_name;
}
err = register_netdevice(dev); err = register_netdevice(dev);
if (err < 0) if (err < 0)
goto err_register_dev; goto err_register_dev;
...@@ -422,6 +433,7 @@ static int veth_newlink(struct net *src_net, struct net_device *dev, ...@@ -422,6 +433,7 @@ static int veth_newlink(struct net *src_net, struct net_device *dev,
err_register_dev: err_register_dev:
/* nothing to do */ /* nothing to do */
err_alloc_name:
err_configure_peer: err_configure_peer:
unregister_netdevice(peer); unregister_netdevice(peer);
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment