From 1ef19f377bf9409d3f2a36f2d1fc9aa28db9923b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= Date: Fri, 6 Sep 2013 11:13:57 -0500 Subject: [PATCH] dhcp: string vs. byte-array of dhcp-client-identifier (rh #999503) Distinguish properly between ASCII strings and byte arrays for dhcp-client-identifier. Else dhclient refuses to parse the configuration file. --- src/dhcp-manager/nm-dhcp-dhclient-utils.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/dhcp-manager/nm-dhcp-dhclient-utils.c b/src/dhcp-manager/nm-dhcp-dhclient-utils.c index db4bf7e8b6..c318e8de96 100644 --- a/src/dhcp-manager/nm-dhcp-dhclient-utils.c +++ b/src/dhcp-manager/nm-dhcp-dhclient-utils.c @@ -76,14 +76,18 @@ add_ip4_config (GString *str, NMSettingIP4Config *s_ip4, const char *hostname) tmp = nm_setting_ip4_config_get_dhcp_client_id (s_ip4); if (tmp) { gboolean is_octets = TRUE; - const char *p = tmp; + int i = 0; - while (*p) { - if (!g_ascii_isxdigit (*p) && (*p != ':')) { + while (tmp[i]) { + if ((i % 3) != 2 && !g_ascii_isxdigit (tmp[i])) { is_octets = FALSE; break; } - p++; + if ((i % 3) == 2 && tmp[i] != ':') { + is_octets = FALSE; + break; + } + i++; } /* If the client ID is just hex digits and : then don't use quotes,