summary refs log tree commit diff
path: root/nixos/modules/tasks/network-interfaces.nix
diff options
context:
space:
mode:
authorWilliam A. Kennington III <william@wkennington.com>2014-11-29 22:34:50 -0800
committerWilliam A. Kennington III <william@wkennington.com>2014-11-29 22:35:03 -0800
commit7ecb084b77ae7f4ae66f844ae23f22e7ceea0879 (patch)
tree9ddff3657cce77068c41abaf5c54815f5e8c1601 /nixos/modules/tasks/network-interfaces.nix
parent017e6b72c123833c609dd45fcd523849d876da53 (diff)
downloadnixpkgs-7ecb084b77ae7f4ae66f844ae23f22e7ceea0879.tar
nixpkgs-7ecb084b77ae7f4ae66f844ae23f22e7ceea0879.tar.gz
nixpkgs-7ecb084b77ae7f4ae66f844ae23f22e7ceea0879.tar.bz2
nixpkgs-7ecb084b77ae7f4ae66f844ae23f22e7ceea0879.tar.lz
nixpkgs-7ecb084b77ae7f4ae66f844ae23f22e7ceea0879.tar.xz
nixpkgs-7ecb084b77ae7f4ae66f844ae23f22e7ceea0879.tar.zst
nixpkgs-7ecb084b77ae7f4ae66f844ae23f22e7ceea0879.zip
nixos/networking: More fixes
Diffstat (limited to 'nixos/modules/tasks/network-interfaces.nix')
-rw-r--r--nixos/modules/tasks/network-interfaces.nix14
1 files changed, 14 insertions, 0 deletions
diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix
index 0ee2c9d2d00..81228ea55a9 100644
--- a/nixos/modules/tasks/network-interfaces.nix
+++ b/nixos/modules/tasks/network-interfaces.nix
@@ -11,6 +11,11 @@ let
   hasSits = cfg.sits != { };
   hasBonds = cfg.bonds != { };
 
+  slaves = concatMap (i: i.interfaces) (attrValues cfg.bonds)
+    ++ concatMap (i: i.interfaces) (attrValues cfg.bridges);
+
+  slaveIfs = map (i: cfg.interfaces.${i}) slaves;
+
   # We must escape interfaces due to the systemd interpretation
   subsystemDevice = interface:
     "sys-subsystem-net-devices-${escapeSystemdPath interface}.device";
@@ -589,6 +594,9 @@ in
       (flip map interfaces (i: {
         assertion = i.subnetMask == null;
         message = "The networking.interfaces.${i.name}.subnetMask option is defunct. Use prefixLength instead.";
+      })) ++ (flip map slaveIfs (i: {
+        assertion = i.ip4 == [ ] && i.ipAddress == null && i.ip6 == [ ] && i.ipv6Address == null;
+        message = "The networking.interfaces.${i.name} must not have any defined ips when it is a slave.";
       })) ++ [
         {
           assertion = cfg.hostId == null || (stringLength cfg.hostId == 8 && isHexString cfg.hostId);
@@ -657,6 +665,12 @@ in
         pkgs.openresolv
       ];
 
+    systemd.targets."network-interfaces" =
+      { description = "All Network Interfaces";
+        wantedBy = [ "network.target" ];
+        unitConfig.X-StopOnReconfiguration = true;
+      };
+
     systemd.services = {
       network-local-commands = {
         description = "Extra networking commands.";