]> git.baikalelectronics.ru Git - kernel.git/commit
veth: Allow to create peer link with given ifindex
authorPavel Emelyanov <xemul@parallels.com>
Wed, 8 Aug 2012 21:53:03 +0000 (21:53 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 9 Aug 2012 23:18:07 +0000 (16:18 -0700)
commitcc6c8971cc2f362be2c1662333640f970f9f0a06
treec586da6003b73a0b356380c6f6302e21426be0ef
parentb73b9e9b6bf203f696deaf5aa982801851c18779
veth: Allow to create peer link with given ifindex

The ifinfomsg is in there (thanks kaber@ for foreseeing this long time ago),
so take the given ifidex and register netdev with it.

Ben noticed, that this code path previously ignored ifmp->ifi_index and
userland could be passing in garbage. Thus it may now fail occasionally
because the value clashes with an existing interface.

To address this it's assumed that if the caller specifies the ifindex for
the veth master device, then it's aware of this possibility and should
explicitly specify (or set to 0 for auto-assignment) the peer's ifindex as
well. With this the compatibility with old tools not setting ifindex is
preserved.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/veth.c