dhcp: honor the send_hostname property

This commit is contained in:
Beniamino Galvani 2021-10-19 20:34:47 +02:00
parent 32443ef3b5
commit 8d40d03a2c

View file

@ -1012,8 +1012,10 @@ config_init(NMDhcpClientConfig *config, const NMDhcpClientConfig *src)
} }
if (config->hostname) { if (config->hostname) {
if ((config->use_fqdn && !nm_sd_dns_name_is_valid(config->hostname)) if (!config->send_hostname) {
|| (!config->use_fqdn && !nm_sd_hostname_is_valid(config->hostname, FALSE))) { nm_clear_g_free((gpointer *) &config->hostname);
} else if ((config->use_fqdn && !nm_sd_dns_name_is_valid(config->hostname))
|| (!config->use_fqdn && !nm_sd_hostname_is_valid(config->hostname, FALSE))) {
nm_log_warn(LOGD_DHCP, nm_log_warn(LOGD_DHCP,
"dhcp%c: %s '%s' is invalid, will be ignored", "dhcp%c: %s '%s' is invalid, will be ignored",
nm_utils_addr_family_to_char(config->addr_family), nm_utils_addr_family_to_char(config->addr_family),