Commit 7e355e7b authored by Andrew Vagin's avatar Andrew Vagin Committed by Andrei Vagin

zdtm: Add tun_ns test

tun test in nested net ns wrapper.
Signed-off-by: 's avatarAndrew Vagin <avagin@virtuozzo.com>
ktkhai: Makefile hunks
Signed-off-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
parent cd7dac19
...@@ -155,6 +155,7 @@ TST_NOFILE := \ ...@@ -155,6 +155,7 @@ TST_NOFILE := \
grow_map02 \ grow_map02 \
grow_map03 \ grow_map03 \
tun \ tun \
tun_ns \
stopped \ stopped \
stopped01 \ stopped01 \
stopped02 \ stopped02 \
...@@ -472,6 +473,7 @@ socket_listen4v6: CFLAGS += -D ZDTM_IPV4V6 ...@@ -472,6 +473,7 @@ socket_listen4v6: CFLAGS += -D ZDTM_IPV4V6
socket-tcp6-closed: CFLAGS += -D ZDTM_IPV6 socket-tcp6-closed: CFLAGS += -D ZDTM_IPV6
socket-tcp6-closed: CFLAGS += -D ZDTM_IPV4V6 socket-tcp6-closed: CFLAGS += -D ZDTM_IPV4V6
socket-tcp-closed-last-ack: CFLAGS += -D ZDTM_TCP_LAST_ACK socket-tcp-closed-last-ack: CFLAGS += -D ZDTM_TCP_LAST_ACK
tun_ns: CFLAGS += -DTUN_NS
mnt_ext_manual: CFLAGS += -D ZDTM_EXTMAP_MANUAL mnt_ext_manual: CFLAGS += -D ZDTM_EXTMAP_MANUAL
sigpending: LDLIBS += -lrt sigpending: LDLIBS += -lrt
vdso01: LDLIBS += -lrt vdso01: LDLIBS += -lrt
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <linux/if.h> #include <linux/if.h>
#include <linux/if_tun.h> #include <linux/if_tun.h>
#include <sched.h>
#include "zdtmtst.h" #include "zdtmtst.h"
...@@ -118,7 +119,10 @@ int main(int argc, char **argv) ...@@ -118,7 +119,10 @@ int main(int argc, char **argv)
char addr[ETH_ALEN], a2[ETH_ALEN]; char addr[ETH_ALEN], a2[ETH_ALEN];
test_init(argc, argv); test_init(argc, argv);
#ifdef TUN_NS
unshare(CLONE_NEWNET);
system("ip link set up dev lo");
#endif
/* fd[0] -- opened file */ /* fd[0] -- opened file */
fds[0] = __open_tun(); fds[0] = __open_tun();
if (fds[0] < 0) { if (fds[0] < 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment