From 0d2f3a409f6c38b0865aa84cf6e3d3adde0f64e4 Mon Sep 17 00:00:00 2001 From: Tycho Andersen Date: Thu, 20 Oct 2016 10:25:29 -0600 Subject: [PATCH] build: add a feature test for linux/net_namespace.h This header was only introduced in 2015, so we need to build without it. travis-ci: success for series starting with [v10,01/11] net: pass the struct nlattrs to dump() functions Signed-off-by: Tycho Andersen Signed-off-by: Pavel Emelyanov --- Makefile.config | 2 +- criu/net.c | 8 +++++++- scripts/feature-tests.mak | 11 +++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Makefile.config b/Makefile.config index 09f7f9602..4edbdb0d1 100644 --- a/Makefile.config +++ b/Makefile.config @@ -18,7 +18,7 @@ export DEFINES += $(FEATURE_DEFINES) export CFLAGS += $(FEATURE_DEFINES) FEATURES_LIST := TCP_REPAIR STRLCPY STRLCAT PTRACE_PEEKSIGINFO \ - SETPROCTITLE_INIT MEMFD TCP_REPAIR_WINDOW + SETPROCTITLE_INIT MEMFD TCP_REPAIR_WINDOW NET_NAMESPACE_H # $1 - config name define gen-feature-test diff --git a/criu/net.c b/criu/net.c index 641e32936..4f19892e3 100644 --- a/criu/net.c +++ b/criu/net.c @@ -1,7 +1,6 @@ #include #include #include -#include #include #include #include @@ -37,6 +36,13 @@ #include "protobuf.h" #include "images/netdev.pb-c.h" +#ifdef CONFIG_HAS_NET_NAMESPACE_H +#include +#else +#define NETNSA_NSID 1 +#define NETNSA_FD 3 +#endif + #ifndef IFLA_LINK_NETNSID #define IFLA_LINK_NETNSID 37 #endif diff --git a/scripts/feature-tests.mak b/scripts/feature-tests.mak index 09bbdc815..7552290c7 100644 --- a/scripts/feature-tests.mak +++ b/scripts/feature-tests.mak @@ -88,3 +88,14 @@ int main(int argc, char *argv[], char *envp[]) } endef + +define FEATURE_TEST_NET_NAMESPACE_H + +#include + +int main(int argc, char **argv) +{ + return 0; +} + +endef