aports/main/openrc/0009-Based-on-the-vrf-patch-it-adds-support-to-run-servic.patch
2023-09-18 06:47:03 +00:00

30 lines
914 B
Diff

From 2f7405254f16cbb33ddb7c57eb20606a92b6c84a Mon Sep 17 00:00:00 2001
From: Thomas Liske <thomas@fiasko-nw.net>
Date: Sat, 16 Sep 2023 18:25:42 +0200
Subject: [PATCH] Based on the vrf patch it adds support to run services in
netns namespaces. It is even possible to stack both options and run services
in a VRF inside a netns namespace.
---
sh/openrc-run.sh.in | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sh/openrc-run.sh.in b/sh/openrc-run.sh.in
index 5eb4224c..2a6605db 100644
--- a/sh/openrc-run.sh.in
+++ b/sh/openrc-run.sh.in
@@ -242,6 +242,11 @@ if [ -n "$vrf" ]; then
RC_VRF_EXEC="/sbin/ip vrf exec $vrf"
fi
+# Add ip netns if configured to run in a netns (netns+vrf may stack)
+if [ -n "$netns" ]; then
+ RC_VRF_EXEC="/sbin/ip netns exec $netns $RC_VRF_EXEC"
+fi
+
# load service supervisor functions
sourcex "@LIBEXECDIR@/sh/runit.sh"
sourcex "@LIBEXECDIR@/sh/s6.sh"
--
2.39.2