From 8c1e848401fc6031130f497e02b3b2cf162e7ee8 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Tue, 23 Jun 2015 21:08:29 +0200 Subject: [PATCH] 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. (cherry picked from commit f23a46d4b79088344f9d0ad4528afb81f492f54c) --- src/settings/plugins/ifcfg-rh/reader.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c index 31928343ce..51253cfa33 100644 --- a/src/settings/plugins/ifcfg-rh/reader.c +++ b/src/settings/plugins/ifcfg-rh/reader.c @@ -4432,13 +4432,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; } }