ifcfg-rh,vlan: fall back to VLAN_ID if vlan id can't be determined from DEVICE

If the device begins with "vlan", but a VLAN ID does not follow, the reader
would fail and ignore the actual VLAN_ID.
This commit is contained in:
Lubomir Rintel
2015-06-23 21:08:29 +02:00
parent edbf766e96
commit f23a46d4b7

View File

@@ -4493,13 +4493,10 @@ make_vlan_setting (shvarFile *ifcfg,
/* Grab VLAN ID from interface name; this takes precedence over the
* separate VLAN_ID property for backwards compat.
*/
vlan_id = (gint) g_ascii_strtoll (p, &end, 10);
if (vlan_id < 0 || vlan_id > 4095 || end == p || *end) {
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
"Failed to determine VLAN ID from DEVICE '%s'",
iface_name);
goto error;
}
gint device_vlan_id = (gint) g_ascii_strtoll (p, &end, 10);
if (device_vlan_id >= 0 && device_vlan_id <= 4095 && end != p && !*end)
vlan_id = device_vlan_id;
}
}