dhcpcd-discuss

RE: Does old_fqdn take on the value of new_dhcp6_fqdn?

Roy Marples

Sat Aug 15 00:58:04 2015

Hi Paul

On 2015-08-15 01:51, Walrath, Paul wrote:
With respect to this change,

# For ease of use, map DHCP6 names onto our DHCP4 names
 case "$reason" in
 BOUND6|RENEW6|REBIND6|REBOOT6|INFORM6)
 	new_fqdn="$new_dhcp6_fqdn"
+	old_fqdn="$old_dhcp6_fqdn"
 	;;
 Esac

Are you sure this is the right place and time to set old_fqdn?  Isn't
old_fqdn needed to keep track of a previously received new_fqdn?  I
would think that old_fqdn should be updated after these scripts have
completed and before the next time these scripts are executed.  That
would mean you need to make the change in the dhcpcd code, not in the
hook script.  Maybe it would be best not to set new_fqdn to
new_dhcp6_fqdn but treat each of these separately in the script.

Each time dhcpcd-run-hooks is called, dhcpcd will create new_ and old_ vars based on the new lease and the old lease.
So any manipulation of the variables is forgotten for each run.

And because there is no direct correlation with DHCPv4 and DHCPv6, moving the handling of the hostname from one to the other would be problematic as there is no way of unsetting it once it is set.
Well, that's not strictly true, you could set

env force_hostname=true

in /etc/dhcpcd.conf and it will be updated each run.

I ran some tests with this change and I'm getting bad results.  My
host name now seems to be stuck at its initial boot value and never
gets updated by the hook script.

I didn't actually test it, I'll try and find the time to do that tomorrow.

Roy

References:
Does old_fqdn take on the value of new_dhcp6_fqdn?Walrath, Paul
Re: Does old_fqdn take on the value of new_dhcp6_fqdn?Roy Marples
RE: Does old_fqdn take on the value of new_dhcp6_fqdn?Walrath, Paul
RE: Does old_fqdn take on the value of new_dhcp6_fqdn?Roy Marples
RE: Does old_fqdn take on the value of new_dhcp6_fqdn?Walrath, Paul
Archive administrator: postmaster@marples.name