From 326891443cea78cfc413b7081032d2106e2f4e05 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 23 Mar 2012 21:00:32 +0000 Subject: [PATCH] * dhcpcd: Don't use the "persistent" option. With it, dhcpcd won't delete routes and addresses when it quits. This causes those routes and addresses to stick around forever, since dhcpcd won't delete them when it runs next (even if it acquires a new lease on the same interface). This is bad; in particular the stale (default) routes can break networking. The downside to removing "persistent" is that you should never ever do "stop dhcpcd" on a remote machine configured by dhcpcd. svn path=/nixos/trunk/; revision=33388 --- modules/services/networking/dhcpcd.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/services/networking/dhcpcd.nix b/modules/services/networking/dhcpcd.nix index 01c65c06865..12a2cc113dc 100644 --- a/modules/services/networking/dhcpcd.nix +++ b/modules/services/networking/dhcpcd.nix @@ -68,11 +68,10 @@ in jobs.dhcpcd = { startOn = "started network-interfaces"; - stopOn = "stopping network-interfaces"; path = [ dhcpcd pkgs.nettools pkgs.openresolv ]; - exec = "dhcpcd --config ${dhcpcdConf} --nobackground --persistent"; + exec = "dhcpcd --config ${dhcpcdConf} --nobackground"; }; environment.systemPackages = [ dhcpcd ]; @@ -85,7 +84,9 @@ in powerManagement.resumeCommands = '' - ${config.system.build.upstart}/sbin/restart dhcpcd + # Tell dhcpcd to rebind its interfaces if it's running. + status="$(${config.system.build.upstart}/sbin/status dhcpcd)" + [[ "$status" =~ start/running ]] && ${dhcpcd}/sbin/dhcpcd --rebind ''; };