From 7a697337040c7460bb876b444f1bebb33204c0f1 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Tue, 8 May 2012 11:46:01 +0000 Subject: [PATCH] Added 'networking.dhcpcd.denyInterfaces' to extend the list of network interfaces black-listed for dhcpcd via configuration.nix. I use this option to disable DHCP for "veth*" interfaces, which are created by LXC for use inside of virtual machines. svn path=/nixos/trunk/; revision=34018 --- modules/services/networking/dhcpcd.nix | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/modules/services/networking/dhcpcd.nix b/modules/services/networking/dhcpcd.nix index b22bbb3f051..122faf98136 100644 --- a/modules/services/networking/dhcpcd.nix +++ b/modules/services/networking/dhcpcd.nix @@ -10,7 +10,8 @@ let # interfaces that are part of a bridge. ignoredInterfaces = map (i: i.name) (filter (i: i ? ipAddress && i.ipAddress != "" ) config.networking.interfaces) - ++ concatLists (attrValues (mapAttrs (n: v: v.interfaces) config.networking.bridges)); + ++ concatLists (attrValues (mapAttrs (n: v: v.interfaces) config.networking.bridges)) + ++ config.networking.dhcpcd.denyInterfaces; # Config file adapted from the one that ships with dhcpcd. dhcpcdConf = pkgs.writeText "dhcpcd.conf" @@ -70,6 +71,23 @@ in { + ###### interface + + options = { + + networking.dhcpcd.denyInterfaces = mkOption { + default = []; + description = '' + Disable the DHCP client for any interface which's name matches + any of the shell glob patterns in this list. The purpose of + this option is blacklist virtual interfaces such as those + created by Xen, libvirt, LXC, etc. + ''; + }; + + }; + + ###### implementation config = mkIf config.networking.useDHCP {