aboutsummaryrefslogtreecommitdiff
path: root/init.d
diff options
context:
space:
mode:
authorPatrick McLean <chutzpah@gentoo.org>2020-11-20 09:21:18 -0800
committerLars Wendler <polynomial-c@gentoo.org>2021-03-11 17:53:29 +0100
commit1e807ce5e4dacf3fd491844588192f8ebb74f3a2 (patch)
tree4087b3b45f9b1502d439c459f58f82137e4dfac5 /init.d
parentMakefile.inc: tag a new release (diff)
downloadnetifrc-1e807ce5e4dacf3fd491844588192f8ebb74f3a2.tar.gz
netifrc-1e807ce5e4dacf3fd491844588192f8ebb74f3a2.tar.bz2
netifrc-1e807ce5e4dacf3fd491844588192f8ebb74f3a2.zip
net/iproute2.sh: Add initial support for network namespaces
This adds initial support for network namespaces. An interface can be assigned to a network namespace with `netns_${IFACE}`. The script will move the interface to the namespace if it is not already there. This adds a helper functions to `functions.sh` called `_netns`, this function facilitates scripts working withing network namespaces. It allows eching to sysfs etc files, globbing, and arbitrary commands within a network namespace. This uses a wrapper for the `ip` command so all calls to it will add `-n ${netns}` so it's operating in the netns. Basic interface configuration is tested and working. Signed-off-by: Patrick McLean <chutzpah@gentoo.org> Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
Diffstat (limited to 'init.d')
-rw-r--r--init.d/net.lo.in6
1 files changed, 6 insertions, 0 deletions
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index fb55788..06304e1 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -660,6 +660,12 @@ start()
_load_modules true
fi
+ for module in ${MODULES}; do
+ if [ "$(command -v "${module}_pre_up")" = "${module}_pre_up" ]; then
+ ${module}_pre_up || exit $?
+ fi
+ done
+
# We up the iface twice if we have a preup to ensure it's up if
# available in preup and afterwards incase the user inadvertently
# brings it down