mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-11 15:27:20 +03:00
Merge pull request #22727 from mayflower/fix/netdev-master-bindsto
network-interfaces service: fix bindsTo deps for masters
This commit is contained in:
commit
c4c23f36ca
@ -60,21 +60,18 @@ let
|
||||
let
|
||||
|
||||
deviceDependency = dev:
|
||||
if (config.boot.isContainer == false)
|
||||
then
|
||||
# Trust udev when not in the container
|
||||
optional (dev != null) (subsystemDevice dev)
|
||||
else
|
||||
# When in the container, check whether the interface is built from other definitions
|
||||
if (hasAttr dev cfg.bridges) ||
|
||||
(hasAttr dev cfg.bonds) ||
|
||||
(hasAttr dev cfg.macvlans) ||
|
||||
(hasAttr dev cfg.sits) ||
|
||||
(hasAttr dev cfg.vlans) ||
|
||||
(hasAttr dev cfg.vswitches) ||
|
||||
(hasAttr dev cfg.wlanInterfaces)
|
||||
then [ "${dev}-netdev.service" ]
|
||||
else [];
|
||||
# Use systemd service if we manage device creation, else
|
||||
# trust udev when not in a container
|
||||
if (hasAttr dev (filterAttrs (k: v: v.virtual) cfg.interfaces)) ||
|
||||
(hasAttr dev cfg.bridges) ||
|
||||
(hasAttr dev cfg.bonds) ||
|
||||
(hasAttr dev cfg.macvlans) ||
|
||||
(hasAttr dev cfg.sits) ||
|
||||
(hasAttr dev cfg.vlans) ||
|
||||
(hasAttr dev cfg.vswitches) ||
|
||||
(hasAttr dev cfg.wlanInterfaces)
|
||||
then [ "${dev}-netdev.service" ]
|
||||
else optional (dev != null && !config.boot.isContainer) (subsystemDevice dev);
|
||||
|
||||
networkLocalCommands = {
|
||||
after = [ "network-setup.service" ];
|
||||
@ -211,7 +208,7 @@ let
|
||||
user "${i.virtualOwner}"
|
||||
'';
|
||||
postStop = ''
|
||||
ip link del ${i.name}
|
||||
ip link del ${i.name} || true
|
||||
'';
|
||||
};
|
||||
|
||||
@ -349,7 +346,7 @@ let
|
||||
ip link set "${n}" up
|
||||
'';
|
||||
postStop = ''
|
||||
ip link delete "${n}"
|
||||
ip link delete "${n}" || true
|
||||
'';
|
||||
});
|
||||
|
||||
@ -377,7 +374,7 @@ let
|
||||
ip link set "${n}" up
|
||||
'';
|
||||
postStop = ''
|
||||
ip link delete "${n}"
|
||||
ip link delete "${n}" || true
|
||||
'';
|
||||
});
|
||||
|
||||
@ -401,7 +398,7 @@ let
|
||||
ip link set "${n}" up
|
||||
'';
|
||||
postStop = ''
|
||||
ip link delete "${n}"
|
||||
ip link delete "${n}" || true
|
||||
'';
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user