git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/network-interfaces-scripted: fix container networking bug

When a bridge interface was reconfigured, running containers using this bridge lost connectivity: restarting network-addresses-brN.service triggered a restart of network-setup.service via a "partOf" relationship introduced in 07e0c0e0a2f237639600f2a0d62f6eac748b1e6e. This in turn restarted brN-netdev.service. The bridge was thus destroyed and recreated with the same name but a new interface id, causing attached veth interfaces to lose their connection. This change removes the "partOf" relationship between network-setup.service and network-addresses-brN.service for all bridges.

commit27420636772da3301d8eed2af417869f7eceac4f authorUli Baum <xeji@cat3.de> dateSun 23 Sep 2018, 22:55 (8 years ago) parent7df10f3
1 file changed+2−1
nixos/modules/tasks/network-interfaces-scripted.nix+2−1
nixos/modules/tasks/network-interfaces-scripted.nix+2−1
@@ -85,7 +85,8 @@ let
8585 after = [ "network-pre.target" "systemd-udevd.service" "systemd-sysctl.service" ];
8686 before = [ "network.target" "shutdown.target" ];
8787 wants = [ "network.target" ];
88− partOf = map (i: "network-addresses-${i.name}.service") interfaces;
88+ # exclude bridges from the partOf relationship to fix container networking bug #47210
89+ partOf = map (i: "network-addresses-${i.name}.service") (filter (i: !(hasAttr i.name cfg.bridges)) interfaces);
8990 conflicts = [ "shutdown.target" ];
9091 wantedBy = [ "multi-user.target" ] ++ optional hasDefaultGatewaySet "network-online.target";
9192