2013-11-30 12:12:12

by Kevin Wilson

[permalink] [raw]
Subject: wireless network interfaces and network namespaces

Hello,
I am trying to move a wireless interface to a network namespace I
created and I get an error:

ip link set wlan0 netns ns1
RTNETLINK answers: Invalid argument

I do it with latest iproute2 git sources, on 3.8 kernel.

I want to verify this: all wireless interfaces do no support
network namespace. Is this true ? what in fact is the reason for this ?

regards,
Kevin


2013-11-30 13:57:21

by Johannes Berg

[permalink] [raw]
Subject: Re: wireless network interfaces and network namespaces



Sergey Ryazanov <[email protected]> wrote:
>2013/11/30 Johannes Berg <[email protected]>:
>> having different virtual interfaces of the same NIC in different
>> namespaces is not supported.
>>
>Is this rule applicable to hwsim interfaces too?

Yes. Hwsim should work with namespaces.

2013-11-30 19:35:56

by Johannes Berg

[permalink] [raw]
Subject: Re: wireless network interfaces and network namespaces

On Sat, 2013-11-30 at 15:58 +0200, Kevin Wilson wrote:
> Thanks!
> Running:
> iw phy phy0 set netns 3433
> indeed moved wlan0 to the network namespace I created, where process 3433 ran.
> I did not see a way to specify the network namespace name for moving
> wlan0 in this command (at least iw help does not show it and I am
> using iw 3.4-1 on ubuntu). I did not looked into the source code of iw
> though.

No, that's not supported since all virtual interfaces (e.g. wlan0)
belonging to a device (e.g. phy0) must move namespaces together.
Otherwise you could do

iw wlan0 interface add wlan0b type managed

and then try to move wlan0 while wlan0b stays in the namespace. In
theory that might actually be useful given appropriate resource
reservation and multi-interface/multi-channel capable devices, but it
would require a massive effort to get it right - it's not useful
enough ;)

johannes


2013-11-30 12:45:30

by Sergey Ryazanov

[permalink] [raw]
Subject: Re: wireless network interfaces and network namespaces

Hi,

2013/11/30 Kevin Wilson <[email protected]>:
> I want to verify this: all wireless interfaces do no support
> network namespace. Is this true ? what in fact is the reason for this ?
>
Yes it is. You may use couple of virtual ethernet interfaces and
bridge to carry traffic between the process that is isolated in
separate namespace and a wireless interface.

--
BR,
Sergey

2013-11-30 13:58:10

by Kevin Wilson

[permalink] [raw]
Subject: Re: wireless network interfaces and network namespaces

Thanks!
Running:
iw phy phy0 set netns 3433
indeed moved wlan0 to the network namespace I created, where process 3433 ran.
I did not see a way to specify the network namespace name for moving
wlan0 in this command (at least iw help does not show it and I am
using iw 3.4-1 on ubuntu). I did not looked into the source code of iw
though.




On Sat, Nov 30, 2013 at 3:14 PM, Johannes Berg
<[email protected]> wrote:
> On Sat, 2013-11-30 at 14:12 +0200, Kevin Wilson wrote:
>> Hello,
>> I am trying to move a wireless interface to a network namespace I
>> created and I get an error:
>>
>> ip link set wlan0 netns ns1
>> RTNETLINK answers: Invalid argument
>>
>> I do it with latest iproute2 git sources, on 3.8 kernel.
>>
>> I want to verify this: all wireless interfaces do no support
>> network namespace. Is this true ? what in fact is the reason for this ?
>
> At least mac80211-based wireless interfaces *do* support namespaces, but
> you have to change the entire wireless NIC's namespace using iw --
> having different virtual interfaces of the same NIC in different
> namespaces is not supported.
>
> johannes
>

2013-11-30 13:36:27

by Sergey Ryazanov

[permalink] [raw]
Subject: Re: wireless network interfaces and network namespaces

2013/11/30 Johannes Berg <[email protected]>:
> having different virtual interfaces of the same NIC in different
> namespaces is not supported.
>
Is this rule applicable to hwsim interfaces too?

--
BR,
Sergey

2013-11-30 13:14:48

by Johannes Berg

[permalink] [raw]
Subject: Re: wireless network interfaces and network namespaces

On Sat, 2013-11-30 at 14:12 +0200, Kevin Wilson wrote:
> Hello,
> I am trying to move a wireless interface to a network namespace I
> created and I get an error:
>
> ip link set wlan0 netns ns1
> RTNETLINK answers: Invalid argument
>
> I do it with latest iproute2 git sources, on 3.8 kernel.
>
> I want to verify this: all wireless interfaces do no support
> network namespace. Is this true ? what in fact is the reason for this ?

At least mac80211-based wireless interfaces *do* support namespaces, but
you have to change the entire wireless NIC's namespace using iw --
having different virtual interfaces of the same NIC in different
namespaces is not supported.

johannes


2014-05-22 09:00:05

by Hannes Raddatz

[permalink] [raw]
Subject: Re: wireless network interfaces and network namespaces

I would like to dig this thread out,
because there might be a bug regarding this topic.

Using ubuntu 12.10, the move of virtual wirless devices (hwsim) to a
namespace and
configuring them inside the namespace with iw wasn't a problem.
But since ubuntu 14.04 I can't
access the devices inside the namespace with iw.
The same problem occurs while using
ubuntu 12.10 with newest backports installed.
Has something changed with the namespaces in
the new linux kernels or is it a bug?

br,
Hannes


2014-05-22 10:46:31

by Johannes Berg

[permalink] [raw]
Subject: Re: wireless network interfaces and network namespaces

On Thu, 2014-05-22 at 08:54 +0000, Hannes Raddatz wrote:
> I would like to dig this thread out,
> because there might be a bug regarding this topic.
>
> Using ubuntu 12.10, the move of virtual wirless devices (hwsim) to a
> namespace and
> configuring them inside the namespace with iw wasn't a problem.
> But since ubuntu 14.04 I can't
> access the devices inside the namespace with iw.
> The same problem occurs while using
> ubuntu 12.10 with newest backports installed.
> Has something changed with the namespaces in
> the new linux kernels or is it a bug?

No idea. Works fine for me on kernel 3.14+mac80211-next.

johannes