summaryrefslogtreecommitdiffstats
path: root/nixos/modules/services/networking/dhcpcd.nix
diff options
context:
space:
mode:
authorMichael Raskin <7c6f434c@mail.ru>2014-08-29 01:09:22 +0400
committerMichael Raskin <7c6f434c@mail.ru>2014-08-29 01:09:22 +0400
commitc42e7dfc0c8563d2e6ffc6eafa5066ea638ef5f0 (patch)
tree72af2d268e20c03e9ba50ed60e50a852ca4b503d /nixos/modules/services/networking/dhcpcd.nix
parentd87b867a2474c6c01019633fa426c77ed16179e9 (diff)
parenta269acf48026b439bce217bd5376bca01298fa07 (diff)
Merge pull request #3200 from wkennington/master.dhcpcd
nixos/dhcpcd: Add an explicit interfaces option
Diffstat (limited to 'nixos/modules/services/networking/dhcpcd.nix')
-rw-r--r--nixos/modules/services/networking/dhcpcd.nix18
1 files changed, 17 insertions, 1 deletions
diff --git a/nixos/modules/services/networking/dhcpcd.nix b/nixos/modules/services/networking/dhcpcd.nix
index 866707c3a913..89aa9bdb6b68 100644
--- a/nixos/modules/services/networking/dhcpcd.nix
+++ b/nixos/modules/services/networking/dhcpcd.nix
@@ -6,6 +6,8 @@ let
dhcpcd = if !config.boot.isContainer then pkgs.dhcpcd else pkgs.dhcpcd.override { udev = null; };
+ cfg = config.networking.dhcpcd;
+
# Don't start dhcpcd on explicitly configured interfaces or on
# interfaces that are part of a bridge, bond or sit device.
ignoredInterfaces =
@@ -38,7 +40,10 @@ let
# (Xen) and virbr* and vnet* (libvirt).
denyinterfaces ${toString ignoredInterfaces} lo peth* vif* tap* tun* virbr* vnet* vboxnet* sit*
- ${config.networking.dhcpcd.extraConfig}
+ # Use the list of allowed interfaces if specified
+ ${optionalString (cfg.allowInterfaces != null) "allowinterfaces ${toString cfg.allowInterfaces}"}
+
+ ${cfg.extraConfig}
'';
# Hook for emitting ip-up/ip-down events.
@@ -81,6 +86,17 @@ in
'';
};
+ networking.dhcpcd.allowInterfaces = mkOption {
+ type = types.nullOr (types.listOf types.str);
+ default = null;
+ description = ''
+ Enable the DHCP client for any interface whose name matches
+ any of the shell glob patterns in this list. Any interface not
+ explicitly matched by this pattern will be denied. This pattern only
+ applies when non-null.
+ '';
+ };
+
networking.dhcpcd.extraConfig = mkOption {
type = types.lines;
default = "";