diff options
author | Tom Gundersen <teg@jklm.no> | 2014-07-14 10:37:25 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-07-15 19:13:07 -0400 |
commit | 5517750f058edd111bcabe5e116056cc63b1f39c (patch) | |
tree | 200173a4d60aa65dc22ece6efa83b8e0f5dd2a29 /drivers/net/veth.c | |
parent | c835a677331495cf137a7f8a023463afd9f032f8 (diff) |
net: rtnetlink - make create_link take name_assign_type
This passes down NET_NAME_USER (or NET_NAME_ENUM) to alloc_netdev(),
for any device created over rtnetlink.
v9: restore reverse-christmas-tree order of local variables
Signed-off-by: Tom Gundersen <teg@jklm.no>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/veth.c')
-rw-r--r-- | drivers/net/veth.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/net/veth.c b/drivers/net/veth.c index 9b945e60530e..8ad596573d17 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c | |||
@@ -335,6 +335,7 @@ static int veth_newlink(struct net *src_net, struct net_device *dev, | |||
335 | struct veth_priv *priv; | 335 | struct veth_priv *priv; |
336 | char ifname[IFNAMSIZ]; | 336 | char ifname[IFNAMSIZ]; |
337 | struct nlattr *peer_tb[IFLA_MAX + 1], **tbp; | 337 | struct nlattr *peer_tb[IFLA_MAX + 1], **tbp; |
338 | unsigned char name_assign_type; | ||
338 | struct ifinfomsg *ifmp; | 339 | struct ifinfomsg *ifmp; |
339 | struct net *net; | 340 | struct net *net; |
340 | 341 | ||
@@ -362,16 +363,20 @@ static int veth_newlink(struct net *src_net, struct net_device *dev, | |||
362 | tbp = tb; | 363 | tbp = tb; |
363 | } | 364 | } |
364 | 365 | ||
365 | if (tbp[IFLA_IFNAME]) | 366 | if (tbp[IFLA_IFNAME]) { |
366 | nla_strlcpy(ifname, tbp[IFLA_IFNAME], IFNAMSIZ); | 367 | nla_strlcpy(ifname, tbp[IFLA_IFNAME], IFNAMSIZ); |
367 | else | 368 | name_assign_type = NET_NAME_USER; |
369 | } else { | ||
368 | snprintf(ifname, IFNAMSIZ, DRV_NAME "%%d"); | 370 | snprintf(ifname, IFNAMSIZ, DRV_NAME "%%d"); |
371 | name_assign_type = NET_NAME_ENUM; | ||
372 | } | ||
369 | 373 | ||
370 | net = rtnl_link_get_net(src_net, tbp); | 374 | net = rtnl_link_get_net(src_net, tbp); |
371 | if (IS_ERR(net)) | 375 | if (IS_ERR(net)) |
372 | return PTR_ERR(net); | 376 | return PTR_ERR(net); |
373 | 377 | ||
374 | peer = rtnl_create_link(net, ifname, &veth_link_ops, tbp); | 378 | peer = rtnl_create_link(net, ifname, name_assign_type, |
379 | &veth_link_ops, tbp); | ||
375 | if (IS_ERR(peer)) { | 380 | if (IS_ERR(peer)) { |
376 | put_net(net); | 381 | put_net(net); |
377 | return PTR_ERR(peer); | 382 | return PTR_ERR(peer); |