uevent when moving nic between network namespaces?
Eric W. Biederman
ebiederm at xmission.com
Fri Oct 12 22:08:21 UTC 2012
Serge Hallyn <serge.hallyn at canonical.com> writes:
> Quoting Eric W. Biederman (ebiederm at xmission.com):
>> I am not currently working on a patch for this, but I will be happy to
>> review one. At a quick glance it looks like this could just be as
>> simple as calling kobject_uevent at the proper time, but testing and
>> reading through the relevant code paths is probably a good idea as there
>> always seems to be gotchas in that code.
> This (the simple fix) works for me, actually.
> I do notice the ifdef shouldn't be needed, all the better.
Should we have a KOBJ_ADD in the new network namespace or is the
> From b436802aa8ae80f699b3d7bcf584d3e86af7355a Mon Sep 17 00:00:00 2001
> From: Serge Hallyn <serge.hallyn at canonical.com>
> Date: Fri, 12 Oct 2012 21:42:05 +0100
> Subject: [PATCH 1/1] dev_change_net_namespace: send a KOBJ_REMOVED to
> original netns
> Signed-off-by: Serge Hallyn <serge.hallyn at canonical.com>
> net/core/dev.c | 4 ++++
> 1 file changed, 4 insertions(+)
> diff --git a/net/core/dev.c b/net/core/dev.c
> index e2215ee..8062a5a 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -6172,6 +6172,10 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
> + /* Send a netdev-removed uevent to the old namespace */
> +#ifdef CONFIG_HOTPLUG
> + kobject_uevent(&dev->dev.kobj, KOBJ_REMOVE);
> /* Actually switch the network namespace */
> dev_net_set(dev, net);
More information about the Containers