diff options
author | Jiri Pirko <jpirko@redhat.com> | 2011-04-29 21:28:17 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-05-02 18:54:31 -0400 |
commit | 6c8c44462ac8ac3f95929328f0c56e9e8b6dd524 (patch) | |
tree | d8e8206cbcdff00eef515b5b9324aedb54a3f0da /drivers/net/veth.c | |
parent | d946092000698fd204d82a9d239103c656fb63bf (diff) |
Revert: veth: remove unneeded ifname code from veth_newlink()
84c49d8c3e4abefb0a41a77b25aa37ebe8d6b743 ("veth: remove unneeded
ifname code from veth_newlink()") caused regression on veth
creation. This patch reverts the original one.
Reported-by: Michał Mirosław <mirqus@gmail.com>
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/veth.c')
-rw-r--r-- | drivers/net/veth.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/net/veth.c b/drivers/net/veth.c index 2de9b90c5f8f..3b99f64104fd 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c | |||
@@ -403,6 +403,17 @@ static int veth_newlink(struct net *src_net, struct net_device *dev, | |||
403 | if (tb[IFLA_ADDRESS] == NULL) | 403 | if (tb[IFLA_ADDRESS] == NULL) |
404 | random_ether_addr(dev->dev_addr); | 404 | random_ether_addr(dev->dev_addr); |
405 | 405 | ||
406 | if (tb[IFLA_IFNAME]) | ||
407 | nla_strlcpy(dev->name, tb[IFLA_IFNAME], IFNAMSIZ); | ||
408 | else | ||
409 | snprintf(dev->name, IFNAMSIZ, DRV_NAME "%%d"); | ||
410 | |||
411 | if (strchr(dev->name, '%')) { | ||
412 | err = dev_alloc_name(dev, dev->name); | ||
413 | if (err < 0) | ||
414 | goto err_alloc_name; | ||
415 | } | ||
416 | |||
406 | err = register_netdevice(dev); | 417 | err = register_netdevice(dev); |
407 | if (err < 0) | 418 | if (err < 0) |
408 | goto err_register_dev; | 419 | goto err_register_dev; |
@@ -422,6 +433,7 @@ static int veth_newlink(struct net *src_net, struct net_device *dev, | |||
422 | 433 | ||
423 | err_register_dev: | 434 | err_register_dev: |
424 | /* nothing to do */ | 435 | /* nothing to do */ |
436 | err_alloc_name: | ||
425 | err_configure_peer: | 437 | err_configure_peer: |
426 | unregister_netdevice(peer); | 438 | unregister_netdevice(peer); |
427 | return err; | 439 | return err; |