ifcfg-rh: fix handling of DHCP_SEND_HOSTNAME when no hostname is given

Move DHCP_SEND_HOSTNAME parsing out of the check for DHCP_HOSTNAME so that
users can disable NM sending the system hostname to the DHCP server when
DHCP_HOSTNAME is not defined.
This commit is contained in:
Dan Williams 2014-01-06 16:20:48 -06:00
parent 91eafe95a3
commit 0b3fdd073e

View file

@ -1365,13 +1365,14 @@ make_ip4_setting (shvarFile *ifcfg,
if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) {
value = svGetValue (ifcfg, "DHCP_HOSTNAME", FALSE);
if (value && strlen (value))
g_object_set (s_ip4,
NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, value,
NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME,
svTrueValue (ifcfg, "DHCP_SEND_HOSTNAME", TRUE),
NULL);
g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, value, NULL);
g_free (value);
g_object_set (s_ip4,
NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME,
svTrueValue (ifcfg, "DHCP_SEND_HOSTNAME", TRUE),
NULL);
value = svGetValue (ifcfg, "DHCP_CLIENT_ID", FALSE);
if (value && strlen (value))
g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, value, NULL);