summaryrefslogtreecommitdiff
path: root/drivers/net/veth.c
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2011-05-20 10:43:00 +0400
committerGrant Likely <grant.likely@secretlab.ca>2011-05-20 10:43:00 +0400
commit78fab4c04c76b8c9327541bd270f82b85b42bbf7 (patch)
treeb43006348a1ac15c28e6791d08646809761a2a4a /drivers/net/veth.c
parent3b8a4dd3ebfcc647260ad5c39ef4f73eb3a6b155 (diff)
parent61c4f2c81c61f73549928dfd9f3e8f26aa36a8cf (diff)
downloadlinux-78fab4c04c76b8c9327541bd270f82b85b42bbf7.tar.xz
Merge commit 'v2.6.39' into spi/next
Diffstat (limited to 'drivers/net/veth.c')
-rw-r--r--drivers/net/veth.c12
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,
if (tb[IFLA_ADDRESS] == NULL)
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);
if (err < 0)
goto err_register_dev;
@@ -422,6 +433,7 @@ static int veth_newlink(struct net *src_net, struct net_device *dev,
err_register_dev:
/* nothing to do */
+err_alloc_name:
err_configure_peer:
unregister_netdevice(peer);
return err;