From: Pavel Maltsev <pavelm@google.com>
To: netdev@vger.kernel.org, lorenzo@google.com,
stephen@networkplumber.org, pavelm@google.com
Cc: lorenzo@google.com, stephen@networkplumber.org,
Pavel Maltsev <pavelm@google.com>
Subject: [PATCH iproute2] Allow to configure /var/run/netns directory
Date: Tue, 15 May 2018 14:49:46 -0700 [thread overview]
Message-ID: <20180515214946.222797-1-pavelm@google.com> (raw)
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@google.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
next reply other threads:[~2018-05-15 21:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-15 21:49 Pavel Maltsev [this message]
2018-05-18 21:53 ` [PATCH iproute2] Allow to configure /var/run/netns directory Stephen Hemminger
2018-05-18 22:48 ` Pavel Maltsev
-- strict thread matches above, loose matches on Subject: below --
2018-05-18 22:44 Pavel Maltsev
2018-05-23 22:30 ` Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180515214946.222797-1-pavelm@google.com \
--to=pavelm@google.com \
--cc=lorenzo@google.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox