[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180515214946.222797-1-pavelm@google.com>
Date: Tue, 15 May 2018 14:49:46 -0700
From: Pavel Maltsev <pavelm@...gle.com>
To: netdev@...r.kernel.org, lorenzo@...gle.com,
stephen@...workplumber.org, pavelm@...gle.com
Cc: lorenzo@...gle.com, stephen@...workplumber.org,
Pavel Maltsev <pavelm@...gle.com>
Subject: [PATCH iproute2] Allow to configure /var/run/netns directory
Currently NETNS_RUN_DIR is hardcoded and refers to /var/run/netns.
However, some systems (e.g. Android) doesn't have /var
which results in error attempts to create network namespaces on these
systems. This change makes NETNS_RUN_DIR configurable at build time
by allowing to pass environment variable to configre script.
For example: NETNS_RUN_DIR=/mnt/vendor/netns ./configure && make
Tested: verified that iproute2 with configuration mentioned above
creates namespaces in /mnt/vendor/netns
Signed-off-by: Pavel Maltsev <pavelm@...gle.com>
---
configure | 3 +++
include/namespace.h | 3 +++
2 files changed, 6 insertions(+)
diff --git a/configure b/configure
index 5ef5cd4c..a6a222da 100755
--- a/configure
+++ b/configure
@@ -213,6 +213,9 @@ EOF
echo "IP_CONFIG_SETNS:=y" >>$CONFIG
echo "yes"
echo "CFLAGS += -DHAVE_SETNS" >>$CONFIG
+ if [ -n "$NETNS_RUN_DIR" ]; then
+ echo "CFLAGS += -DNETNS_RUN_DIR=\\\"$NETNS_RUN_DIR\\\"" >>$CONFIG
+ fi
else
echo "no"
fi
diff --git a/include/namespace.h b/include/namespace.h
index aed7ce08..b8fb14df 100644
--- a/include/namespace.h
+++ b/include/namespace.h
@@ -8,7 +8,10 @@
#include <sys/syscall.h>
#include <errno.h>
+#ifndef NETNS_RUN_DIR
#define NETNS_RUN_DIR "/var/run/netns"
+#endif /* NETNS_RUN_DIR */
+
#define NETNS_ETC_DIR "/etc/netns"
#ifndef CLONE_NEWNET
--
2.17.0.441.gb46fe60e1d-goog
Powered by blists - more mailing lists