diff options
author | David S. Miller <davem@davemloft.net> | 2011-05-05 14:59:02 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-05-05 14:59:02 -0700 |
commit | 7143b7d41218d4fc2ea33e6056c73609527ae687 (patch) | |
tree | 9a842daee1deb57a2c8084bc5d300f6d8428fe34 /drivers/net/veth.c | |
parent | 90864fbc7639d7a2300c67a18c9fb9fbcf7d51d2 (diff) | |
parent | 87e9af6cc67d842cd92b52b81f3f14e665e7ab05 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
drivers/net/tg3.c
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 cbe953a5bf5a..3b0151a2a31b 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c @@ -368,6 +368,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; @@ -387,6 +398,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; |