diff options
author | Jouke Witteveen <j.witteveen@gmail.com> | 2013-07-16 11:37:33 +0200 |
---|---|---|
committer | Jouke Witteveen <j.witteveen@gmail.com> | 2013-07-16 11:37:33 +0200 |
commit | bf493403983f75bd458adc9cc86856586bf25ae9 (patch) | |
tree | ca1d1fe4fc98b5ab1f56cd45e3cadd02eb40dbe0 /src/lib/ip | |
parent | e2ec97c077aba0f45cd09ca3110eae35dc46e07b (diff) | |
download | netctl-bf493403983f75bd458adc9cc86856586bf25ae9.tar.gz netctl-bf493403983f75bd458adc9cc86856586bf25ae9.tar.xz |
Don't release DHCP leases by default (FS#35760)
Regardless of the DHCP client, leases are not released by default.
This introduces a new configuration parameter: DHCPReleaseOnStop, which
can be used to change the default behavior.
Diffstat (limited to 'src/lib/ip')
-rw-r--r-- | src/lib/ip | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -177,17 +177,19 @@ ip_set() { # $IP: type of IPv4 configuration # $IP6: type of IPv6 configuration ip_unset() { + local stop="-x" if [[ $IP == "dhcp" ]]; then case ${DHCPClient:-dhcpcd} in dhcpcd) if [[ -f "/run/dhcpcd-$Interface.pid" ]]; then - do_debug dhcpcd -qk "$Interface" >/dev/null + is_yes "${DHCPReleaseOnStop:-no}" && stop="-k" + do_debug dhcpcd -q $stop "$Interface" >/dev/null fi ;; dhclient) if [[ -f "/run/dhclient-$Interface.pid" ]]; then - # Alternatively, use -r instead of -x to also release the lease - do_debug dhclient -q -x "$Interface" -pf "/run/dhclient-$Interface.pid" >/dev/null + is_yes "${DHCPReleaseOnStop:-no}" && stop="-r" + do_debug dhclient -q $stop "$Interface" -pf "/run/dhclient-$Interface.pid" >/dev/null fi ;; esac |