Re: [PATCH 2/2] mac80211_hwsim: Allow managing radios from non-initial namespaces

2016-05-09 Thread Martin Willi
> > Moving the radio back to the creators namespace would be the most > > consistent behavior, so I'll check how difficult such a reverse > > lookup is. We then would delete the radio only if it is in the > > creators namespace, or if the creators namespace is gone. Does that > > make sense? >

Re: [PATCH 2/2] mac80211_hwsim: Allow managing radios from non-initial namespaces

2016-05-09 Thread Johannes Berg
> > > > + data->netgroup = *(int *)net_generic(net, hwsim_net_id); > Anything doing *(integer_type *) rings alarm bells. > > I suspect you should be defining a structure that currently contains > one integer member. > Something (maybe a compile time assert) needs to check that buffer > space

Re: [PATCH 2/2] mac80211_hwsim: Allow managing radios from non-initial namespaces

2016-05-09 Thread Johannes Berg
On Wed, 2016-05-04 at 10:33 +0200, Martin Willi wrote: > > This changes today's default behaviour of moving the wiphys to the > > default namespace. Did you intend to destroy them based on the > > netgroup, i.e. based on the namespace that created them? Actually, > > maybe they should move back

RE: [PATCH 2/2] mac80211_hwsim: Allow managing radios from non-initial namespaces

2016-05-05 Thread David Laight
From: Martin Willi > Sent: 03 May 2016 07:53 > While wiphys can be moved into network namespaces over nl80211, the > creation and removal of hwsim radios is currently limited to the initial > namespace. This patch allows management of namespaced radios from the > owning namespace by setting

Re: [PATCH 2/2] mac80211_hwsim: Allow managing radios from non-initial namespaces

2016-05-04 Thread Martin Willi
  > > +static __net_init int hwsim_init_net(struct net *net) > > +{ > > + struct mac80211_hwsim_data *data; > > + bool exists = true; > > + int netgroup = 0; > > + > > + spin_lock_bh(_radio_lock); > > + while (exists) { > > + exists = false; > > +

Re: [PATCH 2/2] mac80211_hwsim: Allow managing radios from non-initial namespaces

2016-05-03 Thread Johannes Berg
On Tue, 2016-05-03 at 08:53 +0200, Martin Willi wrote: >  > +static __net_init int hwsim_init_net(struct net *net) > +{ > + struct mac80211_hwsim_data *data; > + bool exists = true; > + int netgroup = 0; > + > + spin_lock_bh(_radio_lock); > + while (exists) { > +

[PATCH 2/2] mac80211_hwsim: Allow managing radios from non-initial namespaces

2016-05-03 Thread Martin Willi
While wiphys can be moved into network namespaces over nl80211, the creation and removal of hwsim radios is currently limited to the initial namespace. This patch allows management of namespaced radios from the owning namespace by setting genetlink netnsok. To prevent two arbitrary namespaces

Re: [PATCH 2/2] mac80211_hwsim: Allow managing radios from non-initial namespaces

2016-05-03 Thread Johannes Berg
On Tue, 2016-05-03 at 08:53 +0200, Martin Willi wrote: > While wiphys can be moved into network namespaces over nl80211, the > creation and removal of hwsim radios is currently limited to the > initial namespace. This patch allows management of namespaced radios > from the owning namespace by