History log of /external/iproute2/ip/ipnetns.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
223f4d8ea6803bd9288d54c819e54a88a63c1730 15-Jul-2011 Eric W. Biederman <ebiederm@xmission.com> iproute2: Fail "ip netns add" on existing network namespaces.

Use O_EXCL so that we only create and mount a new network namespace
if there is no chance an existing network namespace is present.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
/external/iproute2/ip/ipnetns.c
2e8a07f543e6f48f0d0479e3dd4796c18f733e12 15-Jul-2011 Eric W. Biederman <ebiederm@xmission.com> iproute2: Auto-detect the presence of setns in libc

If libc has setns present use that version instead of
rolling the syscall wrapper by hand.

Dan McGee found the following compile error:

gcc -D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -I../include
-DRESOLVE_HOSTNAMES -DLIBDIR=\"/usr/lib/\" -c -o ipnetns.o ipnetns.c
ipnetns.c:31:12: error: static declaration of ‘setns’ follows non-static
declaration
/usr/include/bits/sched.h:93:12: note: previous declaration of ‘setns’
was here
make[1]: *** [ipnetns.o] Error 1

Reported-by: Dan McGee <dan@archlinux.org>
Tested-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
/external/iproute2/ip/ipnetns.c
0dc34c7713bb7055378fe5cbc720d63d0db572a1 13-Jul-2011 Eric W. Biederman <ebiederm@xmission.com> iproute2: Add processless network namespace support

The goal of this code change is to implement a mechanism such that it is
simple to work with a kernel that is using multiple network namespaces
at once.

This comes in handy for interacting with vpns where there may be rfc1918
address overlaps, and different policies default routes, name servers
and the like.

Configuration specific to a network namespace that would ordinarily be
stored under /etc/ is stored under /etc/netns/<name>. For example if
the dns server configuration is different for your vpn you would create
a file /etc/netns/myvpn/resolv.conf.

File descriptors that can be used to manipulate a network namespace can
be created by opening /var/run/netns/<NAME>.

This adds the following commands to iproute.
ip netns add NAME
ip netns delete NAME
ip netns monitor
ip netns list
ip netns exec NAME cmd ....
ip link set DEV netns NAME

ip netns exec exists to cater the vast majority of programs that only
know how to operate in a single network namespace. ip netns exec
changes the default network namespace, creates a new mount namespace,
remounts /sys and bind mounts netns specific configuration files to
their standard locations.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
/external/iproute2/ip/ipnetns.c