* named network namespace -- setns() with Invalid argument (errno 22)
@ 2013-10-30 0:16 Dilip Daya
2013-10-30 4:33 ` Eric W. Biederman
0 siblings, 1 reply; 3+ messages in thread
From: Dilip Daya @ 2013-10-30 0:16 UTC (permalink / raw)
To: netdev; +Cc: Eric W. Biederman
Hi All,
Is the following intended behavior for adding "nested" named network namespaces ?
Steps to reproduce:
# uname -r
3.10.1
# /sbin/ip -V
ip utility, iproute2-ss130903
Existing network namespaces:
# ip netns list
NETNS0
NETNS1
List of named network namespace objects with inode/permissions:
# ls -li /var/run/netns/
total 0
4026532310 -r--r--r-- 1 root root 0 Oct 29 09:11 NETNS0
4026532366 -r--r--r-- 1 root root 0 Oct 29 09:13 NETNS1
Enter existing named network namespace:
# ip netns exec NETNS0 bash
List network devices for named netns:
# ls -l /sys/class/net/
total 0
lrwxrwxrwx 1 root root 0 Oct 29 12:25 lo -> ../../devices/virtual/net/lo/
List of named network namespace objects with inode/permissions:
# ls -li /var/run/netns/
total 0
4026532310 -r--r--r-- 1 root root 0 Oct 29 09:11 NETNS0
4026532366 -r--r--r-- 1 root root 0 Oct 29 09:13 NETNS1
# ip netns add NETNS0a <<< adding NETNS0a from within NETNS0
# ls -li /var/run/netns/
total 0
4026532310 -r--r--r-- 1 root root 0 Oct 29 09:11 NETNS0
4026532366 -r--r--r-- 1 root root 0 Oct 29 09:13 NETNS1
4026532423 -r--r--r-- 1 root root 0 Oct 29 12:28 NETNS0a
^^^^^^^^^^ ^^^^^^^^^^
inode permissions
# ip netns exec NETNS0a ls -l /sys/class/net/
total 0
lrwxrwxrwx 1 root root 0 Oct 29 12:28 lo -> ../../devices/virtual/net/lo
# exit <<< exiting from NETNS0
Listing from host/default namespace:
# ls -li /var/run/netns/
total 0
4026532310 -r--r--r-- 1 root root 0 Oct 29 09:11 NETNS0
4026532366 -r--r--r-- 1 root root 0 Oct 29 09:13 NETNS1
964863 ---------- 1 root root 0 Oct 29 12:28 NETNS0a <<< NULL permissions
^^^^^^ ^^^^^^^^^^
Re-enter NETNS0:
# ip netns exec NETNS0 bash
# ls -li /var/run/netns/
total 0
4026532310 -r--r--r-- 1 root root 0 Oct 29 09:11 NETNS0
4026532366 -r--r--r-- 1 root root 0 Oct 29 09:13 NETNS1
964863 ---------- 1 root root 0 Oct 29 12:28 NETNS0a <<< NULL permissions
^^^^^^^^^^
# ip netns exec NETNS0a ls -l /sys/class/net/
seting the network namespace "NETNS0a" failed: Invalid argument
=> It seems the bash shell that created the nested named netns is the only
one that can view/enter the nested named netns. All other attempts from
either another bash shell or host/default namespace will get a different
inode with NULL permissions. Once the initial bash shell that created the
nested named netns exists the nested netns is rendered unusable due to
NULL permissions on its inode. setns() Invalid argument (errno 22) seems
to be due to NULL permissions on /var/run/netns/<netnsName> object.
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: named network namespace -- setns() with Invalid argument (errno 22)
2013-10-30 0:16 named network namespace -- setns() with Invalid argument (errno 22) Dilip Daya
@ 2013-10-30 4:33 ` Eric W. Biederman
2013-10-30 20:54 ` Eric W. Biederman
0 siblings, 1 reply; 3+ messages in thread
From: Eric W. Biederman @ 2013-10-30 4:33 UTC (permalink / raw)
To: dilip.daya; +Cc: netdev
Dilip Daya <dilip.daya@hp•com> writes:
> Hi All,
>
> Is the following intended behavior for adding "nested" named network namespaces ?
Not exactly intended but this is not misbehavior either.
Mostly this is a don't do that then scenario.
Eric
> Steps to reproduce:
>
> # uname -r
> 3.10.1
>
>
> # /sbin/ip -V
> ip utility, iproute2-ss130903
>
>
> Existing network namespaces:
> # ip netns list
> NETNS0
> NETNS1
>
>
> List of named network namespace objects with inode/permissions:
> # ls -li /var/run/netns/
> total 0
> 4026532310 -r--r--r-- 1 root root 0 Oct 29 09:11 NETNS0
> 4026532366 -r--r--r-- 1 root root 0 Oct 29 09:13 NETNS1
>
> Enter existing named network namespace:
> # ip netns exec NETNS0 bash
>
> List network devices for named netns:
> # ls -l /sys/class/net/
> total 0
> lrwxrwxrwx 1 root root 0 Oct 29 12:25 lo -> ../../devices/virtual/net/lo/
>
> List of named network namespace objects with inode/permissions:
> # ls -li /var/run/netns/
> total 0
> 4026532310 -r--r--r-- 1 root root 0 Oct 29 09:11 NETNS0
> 4026532366 -r--r--r-- 1 root root 0 Oct 29 09:13 NETNS1
>
>
> # ip netns add NETNS0a <<< adding NETNS0a from within NETNS0
> # ls -li /var/run/netns/
> total 0
> 4026532310 -r--r--r-- 1 root root 0 Oct 29 09:11 NETNS0
> 4026532366 -r--r--r-- 1 root root 0 Oct 29 09:13 NETNS1
> 4026532423 -r--r--r-- 1 root root 0 Oct 29 12:28 NETNS0a
> ^^^^^^^^^^ ^^^^^^^^^^
> inode permissions
>
>
> # ip netns exec NETNS0a ls -l /sys/class/net/
> total 0
> lrwxrwxrwx 1 root root 0 Oct 29 12:28 lo -> ../../devices/virtual/net/lo
>
> # exit <<< exiting from NETNS0
>
> Listing from host/default namespace:
> # ls -li /var/run/netns/
> total 0
> 4026532310 -r--r--r-- 1 root root 0 Oct 29 09:11 NETNS0
> 4026532366 -r--r--r-- 1 root root 0 Oct 29 09:13 NETNS1
> 964863 ---------- 1 root root 0 Oct 29 12:28 NETNS0a <<< NULL permissions
> ^^^^^^ ^^^^^^^^^^
>
>
> Re-enter NETNS0:
> # ip netns exec NETNS0 bash
> # ls -li /var/run/netns/
> total 0
> 4026532310 -r--r--r-- 1 root root 0 Oct 29 09:11 NETNS0
> 4026532366 -r--r--r-- 1 root root 0 Oct 29 09:13 NETNS1
> 964863 ---------- 1 root root 0 Oct 29 12:28 NETNS0a <<< NULL permissions
> ^^^^^^^^^^
>
>
> # ip netns exec NETNS0a ls -l /sys/class/net/
> seting the network namespace "NETNS0a" failed: Invalid argument
>
> => It seems the bash shell that created the nested named netns is the only
> one that can view/enter the nested named netns. All other attempts from
> either another bash shell or host/default namespace will get a different
> inode with NULL permissions. Once the initial bash shell that created the
> nested named netns exists the nested netns is rendered unusable due to
> NULL permissions on its inode. setns() Invalid argument (errno 22) seems
> to be due to NULL permissions on /var/run/netns/<netnsName> object.
>
>
> Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: named network namespace -- setns() with Invalid argument (errno 22)
2013-10-30 4:33 ` Eric W. Biederman
@ 2013-10-30 20:54 ` Eric W. Biederman
0 siblings, 0 replies; 3+ messages in thread
From: Eric W. Biederman @ 2013-10-30 20:54 UTC (permalink / raw)
To: dilip.daya; +Cc: netdev
ebiederm@xmission•com (Eric W. Biederman) writes:
> Dilip Daya <dilip.daya@hp•com> writes:
>
>> Hi All,
>>
>> Is the following intended behavior for adding "nested" named network namespaces ?
>
> Not exactly intended but this is not misbehavior either.
>
> Mostly this is a don't do that then scenario.
Let me clarify a little. The primary purpose of ip netns exec is to
allow programs that are not aware or more than one network namespace
to work without modification. It is not intended to be a primary
environment for applications to run in.
Which is a big part of where the don't do that then, comes from.
If you can figure out what is going on and send patches I will be happy
to accept them.
Also public conversation is appreciated so that anyone else with the
same confusions may be educated at the same time.
Eric
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-10-30 20:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-30 0:16 named network namespace -- setns() with Invalid argument (errno 22) Dilip Daya
2013-10-30 4:33 ` Eric W. Biederman
2013-10-30 20:54 ` Eric W. Biederman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox