From 50430f19e1facd8190bafdbc02b156726a7dfb49 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 22 Jan 2010 20:34:32 +0000 Subject: [PATCH] * Only run dhclient on interfaces of type 1, otherwise it fails to start if the machine has weird network devices (e.g. "eql"). svn path=/nixos/trunk/; revision=19623 --- modules/services/networking/dhclient.nix | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/services/networking/dhclient.nix b/modules/services/networking/dhclient.nix index a714562444e0..db3a4b557831 100644 --- a/modules/services/networking/dhclient.nix +++ b/modules/services/networking/dhclient.nix @@ -7,7 +7,7 @@ let inherit (pkgs) nettools dhcp lib; # Don't start dhclient on explicitly configured interfaces. - ignoredInterfaces = ["lo" "wmaster0"] ++ + ignoredInterfaces = map (i: i.name) (lib.filter (i: i ? ipAddress) config.networking.interfaces); stateDir = "/var/lib/dhcp"; # Don't use /var/state/dhcp; not FHS-compliant. @@ -77,9 +77,13 @@ in interfaces= for i in $(cd /sys/class/net && ls -d *); do - if ! for j in ${toString ignoredInterfaces}; do echo $j; done | grep -F -x -q "$i"; then - echo "Running dhclient on $i" - interfaces="$interfaces $i" + # Only run dhclient on interfaces of type ARPHRD_ETHER + # (1), i.e. Ethernet. + if [ "$(cat /sys/class/net/$i/type)" = 1 ]; then + if ! for j in ${toString ignoredInterfaces}; do echo $j; done | grep -F -x -q "$i"; then + echo "Running dhclient on $i" + interfaces="$interfaces $i" + fi fi done