[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: hostname from DNS/DHCP vs netcfg/get_hostname



On Wed, Oct 29, 2014 at 04:14:51PM +0100, Florian Lohoff wrote:
> 
> Hi,
> 
> the d-i (wheezy currently as kernel of jessie disappeared from archive)
> overrides the manually preseeded hostname with an DNS entry.
> 
> So i seed:
> 
> 	netcfg/get_hostname=vm020039
> 
> on the kernel cmdline. Which works when there is no DNS or DHCP hostname
> option. Now i have some ip addresses with reverse DNS entries on them
> and suddenly my hostnames are garbled.
> 
> Can i override this behaviour? I mean IHMO a users choice should always
> override some automatic discoveries.

Found it in the code - So netcfg/hostname is not overidden but
netcfg/get_hostname is ...

netcfg/dhcp.c

572                 debconf_get(client, "netcfg/hostname");
573                 if (!empty_str(client->value)) {
574                     strncpy(buf, client->value, MAXHOSTNAMELEN);
575                     di_debug("Using preseeded hostname");
576                     preseed_hostname_from_fqdn(client, buf);
577                 }
578                 else if (gethostname(buf, sizeof(buf)) == 0
579                     && !empty_str(buf)
580                     && strcmp(buf, "(none)")
581                     ) {
582                     di_info("DHCP hostname: \"%s\"", buf);
583                     preseed_hostname_from_fqdn(client, buf);
584                 }
585                 else if (!empty_str(interface->dhcp_hostname)) {
586                     di_debug("Defaulting hostname to provided DHCP hostname");
587                     debconf_set(client, "netcfg/get_hostname", interface->dhcp_hostname);
588                 } else {
589                     di_debug("Using DNS to try and obtain default hostname");
590                     if (get_hostname_from_dns(interface, buf, sizeof(buf)))
591                         preseed_hostname_from_fqdn(client, buf);
592                 }


-- 
Florian Lohoff                                                 f@zz.de

Attachment: signature.asc
Description: Digital signature


Reply to: