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.
This commit is contained in:

committed by
Dan Williams

parent
7ad5c79441
commit
1ef19f377b
@@ -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);
|
tmp = nm_setting_ip4_config_get_dhcp_client_id (s_ip4);
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
gboolean is_octets = TRUE;
|
gboolean is_octets = TRUE;
|
||||||
const char *p = tmp;
|
int i = 0;
|
||||||
|
|
||||||
while (*p) {
|
while (tmp[i]) {
|
||||||
if (!g_ascii_isxdigit (*p) && (*p != ':')) {
|
if ((i % 3) != 2 && !g_ascii_isxdigit (tmp[i])) {
|
||||||
is_octets = FALSE;
|
is_octets = FALSE;
|
||||||
break;
|
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,
|
/* If the client ID is just hex digits and : then don't use quotes,
|
||||||
|
Reference in New Issue
Block a user