summaryrefslogtreecommitdiffstats
path: root/nixos/modules/services/networking/dhcpcd.nix
diff options
context:
space:
mode:
authorWilliam A. Kennington III <william@wkennington.com>2014-07-04 15:11:16 -0500
committerWilliam A. Kennington III <william@wkennington.com>2014-08-14 14:05:55 -0500
commit320a82dd7f821e3383fe63b21c7c99927913631d (patch)
tree320d9489ab681e31f70c3f5e638c981a28b52f34 /nixos/modules/services/networking/dhcpcd.nix
parent8e99197c9982375f624c9e472c338620c74ddac4 (diff)
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 5a353fc0942a..c541d4fa6041 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.
ignoredInterfaces =
@@ -37,7 +39,10 @@ let
# (Xen) and virbr* and vnet* (libvirt).
denyinterfaces ${toString ignoredInterfaces} lo peth* vif* tap* tun* virbr* vnet* vboxnet*
- ${config.networking.dhcpcd.extraConfig}
+ # Use the list of allowed interfaces if specified
+ ${optionalString (cfg.allowInterfaces != [ ]) "allowinterfaces ${toString cfg.allowInterfaces}"}
+
+ ${cfg.extraConfig}
'';
# Hook for emitting ip-up/ip-down events.
@@ -80,6 +85,17 @@ in
'';
};
+ networking.dhcpcd.allowInterfaces = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ 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 the list is non-empty.
+ '';
+ };
+
networking.dhcpcd.extraConfig = mkOption {
type = types.lines;
default = "";