FS#35760 - [netctl] 1.1-1 DHCP lease is released when profile is deactivated

Attached to Project: Arch Linux
Opened by Alexander Blinne (Sunday) - Tuesday, 11 June 2013, 18:25 GMT
Last edited by Jouke Witteveen (jouke) - Tuesday, 16 July 2013, 09:44 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Jouke Witteveen (jouke)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

Description:

When a dhcp ethernet connection is deactivated and dhcpcd is used, the dhcp lease will be released. If dhclient is used, it won't. This is inconsistent. The corresponding function is ip_unset() in /usr/lib/network/ip:

case ${DHCPClient:-dhcpcd} in
dhcpcd)
if [[ -f "/run/dhcpcd-$Interface.pid" ]]; then
do_debug dhcpcd -qk "$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
fi
;;
esac

As a quick fix I propose the following change to the dhcpcd part:

# Alternatively, use -k instead of -x to also release the lease
do_debug dhcpcd -qx "$Interface" >/dev/null

This will make the behaviour between both dhcp client implementations consistent.

In the long run I think the releasing of the dhcp lease should be configurable independently from the dhcp client implementation.

Additional info:

* package version(s)
netctl 1.1-1
* Discussion in forum
https://bbs.archlinux.org/viewtopic.php?id=159945

Steps to reproduce:

Bring dhcp profile down and up again while DHCPClient=dhcpcd and you may get a different IP (depending on the dhcp server settings). If DHCPClient=dhclient is used, the same IP will be used again.
This task depends upon

Closed by  Jouke Witteveen (jouke)
Tuesday, 16 July 2013, 09:44 GMT
Reason for closing:  Fixed
Additional comments about closing:  bf493
Comment by Jouke Witteveen (jouke) - Sunday, 16 June 2013, 09:06 GMT
Indeed, the right fix is to make such behavior configurable, but it is not clear which features should be, and which should not.

The question for now is: what should be the default, to release or not to release the lease
Comment by Alexander Blinne (Sunday) - Sunday, 16 June 2013, 11:06 GMT
I have yet another suggestion. I think most of the time one wants to not release the lease on every deactivation. I find it convenient to get the same IP address when the computer is rebooted, I think this would be a sensible default behaviour. Some people might want to release the lease every time, that could be made possible as a configuration option to the netctl profile.

It might still be useful to be able to override the configured behaviour when a profile is manually deactivated ($ netctl stop my-profile-which-does-not-release --release-dhcp-lease). So one could still release the lease explicitly one wants to have a new ip address for whatever reason.

Loading...