diff options
Diffstat (limited to 'drivers/net/veth.c')
-rw-r--r-- | drivers/net/veth.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/net/veth.c b/drivers/net/veth.c index 35609e64f6fd..b583d4968add 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c | |||
@@ -333,19 +333,17 @@ static int veth_newlink(struct net *src_net, struct net_device *dev, | |||
333 | struct veth_priv *priv; | 333 | struct veth_priv *priv; |
334 | char ifname[IFNAMSIZ]; | 334 | char ifname[IFNAMSIZ]; |
335 | struct nlattr *peer_tb[IFLA_MAX + 1], **tbp; | 335 | struct nlattr *peer_tb[IFLA_MAX + 1], **tbp; |
336 | struct ifinfomsg *ifmp; | ||
336 | struct net *net; | 337 | struct net *net; |
337 | 338 | ||
338 | /* | 339 | /* |
339 | * create and register peer first | 340 | * create and register peer first |
340 | * | ||
341 | * struct ifinfomsg is at the head of VETH_INFO_PEER, but we | ||
342 | * skip it since no info from it is useful yet | ||
343 | */ | 341 | */ |
344 | |||
345 | if (data != NULL && data[VETH_INFO_PEER] != NULL) { | 342 | if (data != NULL && data[VETH_INFO_PEER] != NULL) { |
346 | struct nlattr *nla_peer; | 343 | struct nlattr *nla_peer; |
347 | 344 | ||
348 | nla_peer = data[VETH_INFO_PEER]; | 345 | nla_peer = data[VETH_INFO_PEER]; |
346 | ifmp = nla_data(nla_peer); | ||
349 | err = nla_parse(peer_tb, IFLA_MAX, | 347 | err = nla_parse(peer_tb, IFLA_MAX, |
350 | nla_data(nla_peer) + sizeof(struct ifinfomsg), | 348 | nla_data(nla_peer) + sizeof(struct ifinfomsg), |
351 | nla_len(nla_peer) - sizeof(struct ifinfomsg), | 349 | nla_len(nla_peer) - sizeof(struct ifinfomsg), |
@@ -358,8 +356,10 @@ static int veth_newlink(struct net *src_net, struct net_device *dev, | |||
358 | return err; | 356 | return err; |
359 | 357 | ||
360 | tbp = peer_tb; | 358 | tbp = peer_tb; |
361 | } else | 359 | } else { |
360 | ifmp = NULL; | ||
362 | tbp = tb; | 361 | tbp = tb; |
362 | } | ||
363 | 363 | ||
364 | if (tbp[IFLA_IFNAME]) | 364 | if (tbp[IFLA_IFNAME]) |
365 | nla_strlcpy(ifname, tbp[IFLA_IFNAME], IFNAMSIZ); | 365 | nla_strlcpy(ifname, tbp[IFLA_IFNAME], IFNAMSIZ); |
@@ -387,6 +387,10 @@ static int veth_newlink(struct net *src_net, struct net_device *dev, | |||
387 | 387 | ||
388 | netif_carrier_off(peer); | 388 | netif_carrier_off(peer); |
389 | 389 | ||
390 | err = rtnl_configure_link(peer, ifmp); | ||
391 | if (err < 0) | ||
392 | goto err_configure_peer; | ||
393 | |||
390 | /* | 394 | /* |
391 | * register dev last | 395 | * register dev last |
392 | * | 396 | * |
@@ -428,6 +432,7 @@ static int veth_newlink(struct net *src_net, struct net_device *dev, | |||
428 | err_register_dev: | 432 | err_register_dev: |
429 | /* nothing to do */ | 433 | /* nothing to do */ |
430 | err_alloc_name: | 434 | err_alloc_name: |
435 | err_configure_peer: | ||
431 | unregister_netdevice(peer); | 436 | unregister_netdevice(peer); |
432 | return err; | 437 | return err; |
433 | 438 | ||