diff options
-rw-r--r-- | networking/ifupdown.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/networking/ifupdown.c b/networking/ifupdown.c index f703a5d..b2ce2a0 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c @@ -555,8 +555,11 @@ static int dhcp_down(struct interface_defn_t *ifd, execfn *exec) { int result = 0; if (execable("/sbin/udhcpc")) { + /* SIGUSR2 forces udhcpc to release the current lease and go inactive, + * and SIGTERM causes udhcpc to exit. Signals are queued and processed + * sequentially so we don't need to sleep */ result = execute("kill -USR2 `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", ifd, exec); - result += execute("kill -9 `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", ifd, exec); + result += execute("kill -TERM `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", ifd, exec); } else if (execable("/sbin/pump")) { result = execute("pump -i %iface% -k", ifd, exec); } else if (execable("/sbin/dhclient")) { |