remarkable-linux/net/core
Serge Hallyn 4e66ae2ea3 net: dev_change_net_namespace: send a KOBJ_REMOVED/KOBJ_ADD
When a new nic is created in namespace ns1, the kernel sends a KOBJ_ADD uevent
to ns1.  When the nic is moved to ns2, we only send a KOBJ_MOVE to ns2, and
nothing to ns1.

This patch changes that behavior so that when moving a nic from ns1 to ns2, we
send a KOBJ_REMOVED to ns1 and KOBJ_ADD to ns2.  (The KOBJ_MOVE is still
sent to ns2).

The effects of this can be seen when starting and stopping containers in
an upstart based host.  Lxc will create a pair of veth nics, the kernel
sends KOBJ_ADD, and upstart starts network-instance jobs for each.  When
one nic is moved to the container, because no KOBJ_REMOVED event is
received, the network-instance job for that veth never goes away.  This
was reported at https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1065589
With this patch the networ-instance jobs properly go away.

The other oddness solved here is that if a nic is passed into a running
upstart-based container, without this patch no network-instance job is
started in the container.  But when the container creates a new nic
itself (ip link add new type veth) then network-interface jobs are
created.  With this patch, behavior comes in line with a regular host.

v2: also send KOBJ_ADD to new netns.  There will then be a
_MOVE event from the device_rename() call, but that should
be innocuous.

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: Daniel Lezcano <daniel.lezcano@free.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
2012-12-04 13:25:57 -05:00
..
datagram.c
dev.c net: dev_change_net_namespace: send a KOBJ_REMOVED/KOBJ_ADD 2012-12-04 13:25:57 -05:00
dev_addr_lists.c net: correct check in dev_addr_del() 2012-11-15 17:57:53 -05:00
drop_monitor.c
dst.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2012-10-02 13:38:27 -07:00
ethtool.c net: Allow userns root control of the core of the network stack. 2012-11-18 20:32:45 -05:00
fib_rules.c net: Enable a userns root rtnl calls that are safe for unprivilged users 2012-11-18 20:33:36 -05:00
filter.c sk-filter: Add ability to get socket filter program (v2) 2012-11-01 11:17:15 -04:00
flow.c net: core: use this_cpu_ptr per-cpu helper 2012-11-19 18:59:44 -05:00
flow_dissector.c ipv6: add ipv6_addr_hash() helper 2012-07-18 11:28:46 -07:00
gen_estimator.c
gen_stats.c
iovec.c
link_watch.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2012-10-02 13:38:27 -07:00
Makefile
neighbour.c net: Enable a userns root rtnl calls that are safe for unprivilged users 2012-11-18 20:33:36 -05:00
net-sysfs.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2012-11-25 12:49:17 -05:00
net-sysfs.h
net-traces.c
net_namespace.c userns: make each net (net_ns) belong to a user_ns 2012-11-18 20:30:55 -05:00
netevent.c
netpoll.c netpoll: call ->ndo_select_queue() in tx path 2012-09-19 17:19:09 -04:00
netprio_cgroup.c cgroup: net_prio: Mark local used function static 2012-10-26 03:40:50 -04:00
pktgen.c pktgen: clean up ktime_t helpers 2012-11-03 14:50:15 -04:00
request_sock.c tcp: TCP Fast Open Server - support TFO listeners 2012-08-31 20:02:19 -04:00
rtnetlink.c rtnelink: remove unused parameter from rtnl_create_link(). 2012-11-30 12:24:40 -05:00
scm.c net: Allow userns root to force the scm creds 2012-11-18 20:32:45 -05:00
secure_seq.c netfilter: ipv6: add IPv6 NAT support 2012-08-30 03:00:17 +02:00
skbuff.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2012-11-10 18:32:51 -05:00
sock.c sockopt: Change getsockopt() of SO_BINDTODEVICE to return an interface name 2012-11-26 17:22:14 -05:00
sock_diag.c netlink: hide struct module parameter in netlink_kernel_create 2012-09-08 18:46:30 -04:00
stream.c
sysctl_net_core.c net: Don't export sysctls to unprivileged users 2012-11-18 20:30:55 -05:00
timestamping.c
user_dma.c
utils.c net: add doc for in4_pton() 2012-10-12 13:56:52 -04:00