net: initialize name for a moved device

This patch fixes segmentation fault of the ct_net_host test:
./ct_net_host > ct_net_host.out
Segmentation fault (core dumped)

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
fs: add suppor of read-only and private bind-mounts (v3)

v2: rollback on an error path and print errors
v3: fix an error path in fs_mount_alloc

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
libct: rename add_mount to add_bind_mount

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
util: rename bind_mount to do_mount

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
fs: add ability to mount file systems in CT (v2)

devpts, tmpfs, shm, etc can be mounted in CT.

v2: free fstype and data
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
net: don't leak ct_net->addr and ct_net->master

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
net: don't leak ct_net_host_nic->name

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Update README.md

Remove mention of 'unix' session. This is an addition to commit 408db2d6492

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
README.md: format links as such, minor rewording

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
test/Makefile: tests should use local libs

This adds linker options so that test binaries compiled will use
the local copy of libct and libnl libs (instead of system ones).

This gives us two benefits:

 1 ability to run tests without installing the libraries or using
   tricks such as LD_LIBRARY_PATH;

 2 confidence that the proper libs are used, not some old ones.

Before this commit:

 [kir@kirpad test]$ ldd ct_create
	linux-vdso.so.1 =>  (0x00007fff121fe000)
 ->	libct.so => not found
 ->	libnl-route-3.so.200 => /lib64/libnl-route-3.so.200 (0x00007f20d9996000)
 ->	libnl-3.so.200 => /lib64/libnl-3.so.200 (0x00007f20d9778000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f20d93b9000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f20d919b000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f20d8e94000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f20d9c1f000)

After:

 [kir@kirpad test]$ ldd ct_create
	linux-vdso.so.1 =>  (0x00007fffb72fc000)
 ->	libct.so => /vz/kir/git/libct/test/./../src/libct.so (0x00007f1061c58000)
 ->	libnl-route-3.so.200 => /vz/kir/git/libct/test/./../.shipped/libnl/lib/.libs/libnl-route-3.so.200 (0x00007f10619f7000)
 ->	libnl-3.so.200 => /vz/kir/git/libct/test/./../.shipped/libnl/lib/.libs/libnl-3.so.200 (0x00007f10617da000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f10613ed000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f10611cf000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f1060ec8000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f1061e67000)

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
net.c: whitespace cleanup

Fix 'eight spaces instead of a tab' syndrome.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
net_sock_open: use pr_err()

We should not use pr_perror() here as nl_connect() doesn't set errno.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
py: fix libct_container_net_add usage

libct_container_net_add returns a handler now,
so fix python wrappers accordingly.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
fix python binding compilation

Add netlink libraries.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
add libct_container_enter_execv*fds functions

Add functions libct_container_enter_execvfds and
libct_container_enter_execvefds, which allow to execute
a process inside a container with given file descriptiors as
stdin, stdout and stderr.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
py: add wrappers for libct_container_enter_execv*fds

Add wrappers for functions libct_container_enter_execv*fds.
Container.enter_execve and Container.enter_execv take
additional keyword argument fds now.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>