* 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
This commit is contained in:
parent
9094ecb546
commit
50430f19e1
@ -7,7 +7,7 @@ let
|
|||||||
inherit (pkgs) nettools dhcp lib;
|
inherit (pkgs) nettools dhcp lib;
|
||||||
|
|
||||||
# Don't start dhclient on explicitly configured interfaces.
|
# Don't start dhclient on explicitly configured interfaces.
|
||||||
ignoredInterfaces = ["lo" "wmaster0"] ++
|
ignoredInterfaces =
|
||||||
map (i: i.name) (lib.filter (i: i ? ipAddress) config.networking.interfaces);
|
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.
|
stateDir = "/var/lib/dhcp"; # Don't use /var/state/dhcp; not FHS-compliant.
|
||||||
@ -77,9 +77,13 @@ in
|
|||||||
interfaces=
|
interfaces=
|
||||||
|
|
||||||
for i in $(cd /sys/class/net && ls -d *); do
|
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
|
# Only run dhclient on interfaces of type ARPHRD_ETHER
|
||||||
echo "Running dhclient on $i"
|
# (1), i.e. Ethernet.
|
||||||
interfaces="$interfaces $i"
|
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
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user