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.
This commit is contained in:
Erik Arvstedt 2021-11-08 12:45:28 +01:00
parent 7f77147b60
commit cb6e5ef702
No known key found for this signature in database
GPG Key ID: 33312B944DD97846

View File

@ -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