]> git.baikalelectronics.ru Git - kernel.git/commit
dev: advertise the new nsid when the netns iface changes
authorNicolas Dichtel <nicolas.dichtel@6wind.com>
Tue, 3 Oct 2017 11:53:23 +0000 (13:53 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 5 Oct 2017 01:04:41 +0000 (18:04 -0700)
commite8758477e7b407fbdedc302682fd76cd05b8f491
treea2c5dda82a7e702b0abb40a37ec596eca0932a2f
parente113a25fb5185f2a4f1dad6f2679dc5af0735ee8
dev: advertise the new nsid when the netns iface changes

x-netns interfaces are bound to two netns: the link netns and the upper
netns. Usually, this kind of interfaces is created in the link netns and
then moved to the upper netns. At the end, the interface is visible only
in the upper netns. The link nsid is advertised via netlink in the upper
netns, thus the user always knows where is the link part.

There is no such mechanism in the link netns. When the interface is moved
to another netns, the user cannot "follow" it.
This patch adds a new netlink attribute which helps to follow an interface
which moves to another netns. When the interface is unregistered, the new
nsid is advertised. If the interface is a x-netns interface (ie
rtnl_link_ops->get_link_net is defined), the nsid is allocated if needed.

CC: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/rtnetlink.h
include/uapi/linux/if_link.h
net/core/dev.c
net/core/rtnetlink.c