Subject: Re: wireless vs. network namespaces (part II)

From: [email-masked] (Eric W. Biederman)
Date: Sun, 28 Sep 2008 22:44:14 -0700

>> >  * ensure that all netdevs created for this wiphy will have the right
>> >    netns.
>> >
>> > The latter part I'm unsure on, alloc_netdev_mq seems to always use
>> > init_net so I can't put them into the right namespace to start with, but
>> > because they're all "in there together" I can't allow switching
>> > namespaces either.. Ideas?
>> 
>> alloc_netdev_mq doesn't register the device, so it is a matter of simply
>> changing the network device pointer after allocation and before registration.
>> 
>> We do this by default when we dynamically create network devices using
>> netlink.  see rtnl_create_link for an example.
>
> Ok. So I guess I'd want to write a wrapper for registering the netdev
> that puts it into the right namespace for the wireless hardware and sets
> the NETIF_F_NETNS_LOCAL flag.

> I'll have to experiment a bit I guess.

So you are looking at using NETIF_F_NETNS_LOCAL to indicate that you can't move
one of the devices?

There is an UNREGISTER_NETDEV event and a REGISTER_NETDEV event sent when a device
is moved between namespaces.  See:  dev_change_net_namespace.

I think you would want to look onto those and move one network device when you
move the other, without using NETIF_F_NETNS_LOCAL.

Deletion and creation we have definitely done with paired veth devices.  I haven't
looked at the migration case, but I with a little bit of guarding against recursion
it looks like it probably can be handled.  

Say trigger when your parnter device calls REGISTER_NETDEV in a different network
namespace?

Eric