summaryrefslogtreecommitdiff
path: root/aports/openrc/0009-Based-on-the-vrf-patch-it-adds-support-to-run-servic.patch
blob: bd149d98d3cd89f7cc477c4e7b125b88c648a67f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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