dhcpcd-discuss

Re: Does old_fqdn take on the value of new_dhcp6_fqdn?

Roy Marples

Fri Aug 14 22:25:14 2015

Hi Paul

On Friday 14 August 2015 17:24:16 Walrath, Paul wrote:
> In the 30-hostname hook script there is the following:
> 
> # For ease of use, map DHCP6 names onto our DHCP4 names
> case "$reason" in
> BOUND6|RENEW6|REBIND6|REBOOT6|INFORM6)
>         new_fqdn="$new_dhcp6_fqdn"
>         ;;
> esac
> 
> The next time this script is run, does $old_fqdn have the value remembered
> from $new_dhcp6_fqdn or is it still set to the $new_fqdn value from
> processing a previous DHCPv4 reply?

old_fqdn would be generated from a prior DHCPv4 lease only

> If the $new_dhcp6_fqdn value is not used for $old_fqdn, then I think some of
> the code in 30-hostname won't run correctly.  Specifically this part in
> need_hostname():
> 
> 
>         if [ -n "$old_fqdn" ]; then
> 
>                if ${hfqdn} || ! ${hsort}; then
> 
>                        [ "$hostname" = "$old_fqdn" ]
> 
>                else
> 
>                        [ "$hostname" = "${old_fqdn%%.*}" ]
> 
>                fi
> 
>         elif [ -n "$old_host_name" ]; then

You're right.
This patch should fix it

Index: dhcpcd-hooks/30-hostname
==================================================================
--- dhcpcd-hooks/30-hostname
+++ dhcpcd-hooks/30-hostname
@@ -144,11 +144,12 @@
 
 # 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
 
 if $if_up; then
 	set_hostname
 fi


http://roy.marples.name/projects/dhcpcd/vpatch?from=33ba0b530f22a445&to=3592407ffc5ed593

Roy

Follow-Ups:
RE: Does old_fqdn take on the value of new_dhcp6_fqdn?Walrath, Paul
References:
Does old_fqdn take on the value of new_dhcp6_fqdn?Walrath, Paul
Archive administrator: postmaster@marples.name