dhcpcd-discuss

dhcp v4 set hostname clobbered by slaac

Mark Davies

Mon Apr 20 02:32:57 2020

Hi,
   I've been meaning to report this for a while:

ArchLinux running dhcpcd-8.1.2 (but also happened in older versions and
looks like may still happen in 9.0.1).

Machines getting config, including hostname, via ipv4 dhcp (so running
the 30-hostname hook) and getting ipv6 addressing via slaac.

The hostname is successfully set on receipt of the dhcp packets, but
then is reset to "localhost" each time a routeradvertisment packet is
received.

The following patch to hooks/30-hostname fixes the issue for me.

--- dhcpcd-hooks/30-hostname    2019-11-15 05:34:16.000000000 +1300
+++ dhcpcd-hooks/30-hostname    2019-12-11 10:40:47.935238981 +1300
@@ -156,6 +156,6 @@
        ;;
 esac

-if $if_up; then
+if $if_up && [ "$reason" != ROUTERADVERT ]; then
        set_hostname
 fi


cheers
mark

Follow-Ups:
Re: dhcp v4 set hostname clobbered by slaacRoy Marples
Archive administrator: postmaster@marples.name