From d5fe28da6758594f40eb533c46b67836edcd3fd5 Mon Sep 17 00:00:00 2001 From: Andrew Vagin Date: Fri, 2 Mar 2018 15:46:53 +0300 Subject: [PATCH] zdtm: Add tun_ns test tun test in nested net ns wrapper. Signed-off-by: Andrew Vagin ktkhai: Makefile hunks Signed-off-by: Kirill Tkhai --- test/zdtm/static/Makefile | 2 ++ test/zdtm/static/tun.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile index fd333ee0b..c8f95155e 100644 --- a/test/zdtm/static/Makefile +++ b/test/zdtm/static/Makefile @@ -157,6 +157,7 @@ TST_NOFILE := \ grow_map02 \ grow_map03 \ tun \ + tun_ns \ stopped \ stopped01 \ stopped02 \ @@ -483,6 +484,7 @@ socket_listen4v6: CFLAGS += -D ZDTM_IPV4V6 socket-tcp6-closed: CFLAGS += -D ZDTM_IPV6 socket-tcp6-closed: CFLAGS += -D ZDTM_IPV4V6 socket-tcp-closed-last-ack: CFLAGS += -D ZDTM_TCP_LAST_ACK +tun_ns: CFLAGS += -DTUN_NS mnt_ext_manual: CFLAGS += -D ZDTM_EXTMAP_MANUAL sigpending: LDLIBS += -lrt vdso01: LDLIBS += -lrt diff --git a/test/zdtm/static/tun.c b/test/zdtm/static/tun.c index c53b8fa88..98519e5d2 100644 --- a/test/zdtm/static/tun.c +++ b/test/zdtm/static/tun.c @@ -5,6 +5,7 @@ #include #include #include +#include #include "zdtmtst.h" @@ -118,7 +119,10 @@ int main(int argc, char **argv) char addr[ETH_ALEN], a2[ETH_ALEN]; test_init(argc, argv); - +#ifdef TUN_NS + unshare(CLONE_NEWNET); + system("ip link set up dev lo"); +#endif /* fd[0] -- opened file */ fds[0] = __open_tun(); if (fds[0] < 0) {