policy: fix setting hostname from DHCP options (rh #719100)

This commit fixes a regression introduced by commit
6272052f9d.

dhclient prefixes options with "new_", however we remove that prefix
before putting options into NMDHCP4Config.
This commit is contained in:
Jiří Klimeš 2011-10-20 16:51:02 +02:00
parent 6e92c1b606
commit 74615ce23c

View file

@ -322,7 +322,7 @@ update_system_hostname (NMPolicy *policy, NMDevice *best4, NMDevice *best6)
/* Grab a hostname out of the device's DHCP4 config */
dhcp4_config = nm_device_get_dhcp4_config (best4);
if (dhcp4_config) {
p = dhcp_hostname = nm_dhcp4_config_get_option (dhcp4_config, "new_host_name");
p = dhcp_hostname = nm_dhcp4_config_get_option (dhcp4_config, "host_name");
if (dhcp_hostname && strlen (dhcp_hostname)) {
/* Sanity check; strip leading spaces */
while (*p) {
@ -341,7 +341,7 @@ update_system_hostname (NMPolicy *policy, NMDevice *best4, NMDevice *best6)
/* Grab a hostname out of the device's DHCP6 config */
dhcp6_config = nm_device_get_dhcp6_config (best6);
if (dhcp6_config) {
p = dhcp_hostname = nm_dhcp6_config_get_option (dhcp6_config, "new_host_name");
p = dhcp_hostname = nm_dhcp6_config_get_option (dhcp6_config, "host_name");
if (dhcp_hostname && strlen (dhcp_hostname)) {
/* Sanity check; strip leading spaces */
while (*p) {