From cb6e5ef7029954a737bdb45401c573d051cf9501 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Mon, 8 Nov 2021 12:45:28 +0100 Subject: [PATCH] netns-isolation: fix routing issues due to netns restarting Previously, restarting a service implied restarting its netns. For unknown reasons, this sometimes caused the netns-local address to not be routable from the root netns for up to 20 s. I.e., the service was sometimes unreachable after restarting. Now the netns is no longer stopped when the service is stopped. --- modules/netns-isolation.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/netns-isolation.nix b/modules/netns-isolation.nix index a2dc63f..655325e 100644 --- a/modules/netns-isolation.nix +++ b/modules/netns-isolation.nix @@ -164,9 +164,8 @@ in { "netns-${n}" = rec { requires = [ "nb-netns-bridge.service" ]; after = [ "nb-netns-bridge.service" ]; - bindsTo = [ "${n}.service" ]; - requiredBy = bindsTo; - before = bindsTo; + requiredBy = [ "${n}.service" ]; + before = requiredBy; script = '' ${ip} netns add ${netnsName} ${ipNetns} link set lo up