summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2017-09-06 18:11:30 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2017-09-08 17:08:31 +0200
commit78bb9d593e054304c15cb98c399457b4d361ebf5 (patch)
treea7bd03db8d364e2061be91d243543d9d896a32fb
parent9e3afc500632f95f67f6b84bf2c0bef8355b98e0 (diff)
downloadNetworkManager-bg/vlan-device-ifcfg-rh1400649.tar.gz
ifcfg-rh: add VID together with VLAN_IDbg/vlan-device-ifcfg-rh1400649
Initscripts added support for arbitrary VLAN id using a variable different from NM's: https://github.com/fedora-sysv/initscripts/commit/368d19d31a057bf4d82ba428629694618edce133 Let's write both the NM (VLAN_ID) and initscripts (VID) variable. This is ugly.
-rw-r--r--libnm-core/nm-setting-vlan.c2
-rw-r--r--src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c2
-rw-r--r--src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c3
-rw-r--r--src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-Test_Write_VLAN_reorder_hdr.cexpected1
-rw-r--r--src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-Vlan_test-vlan-interface.cexpected1
-rw-r--r--src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-team-slave-enp31s0f1-142.cexpected1
-rw-r--r--src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-vlan-flags-12
7 files changed, 10 insertions, 2 deletions
diff --git a/libnm-core/nm-setting-vlan.c b/libnm-core/nm-setting-vlan.c
index f9c6e02d66..5c807f6445 100644
--- a/libnm-core/nm-setting-vlan.c
+++ b/libnm-core/nm-setting-vlan.c
@@ -877,7 +877,7 @@ nm_setting_vlan_class_init (NMSettingVlanClass *setting_class)
**/
/* ---ifcfg-rh---
* property: id
- * variable: VLAN_ID or DEVICE
+ * variable: VLAN_ID or VID or DEVICE
* description: VLAN identifier.
* ---end---
*/
diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
index 7fdb9d53e3..9828671ceb 100644
--- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
+++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
@@ -4922,6 +4922,8 @@ make_vlan_setting (shvarFile *ifcfg,
gint gvrp, reorder_hdr;
value = svGetValueStr_cp (ifcfg, "VLAN_ID");
+ if (!value)
+ value = svGetValueStr_cp (ifcfg, "VID");
if (value) {
vlan_id = _nm_utils_ascii_str_to_int64 (value, 10, 0, 4095, -1);
if (vlan_id == -1) {
diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c
index bb52a2002e..14d70f91f3 100644
--- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c
+++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c
@@ -1209,6 +1209,9 @@ write_vlan_setting (NMConnection *connection, shvarFile *ifcfg, gboolean *wired,
svSetValueStr (ifcfg, "TYPE", TYPE_VLAN);
svSetValueStr (ifcfg, "PHYSDEV", nm_setting_vlan_get_parent (s_vlan));
svSetValueInt64 (ifcfg, "VLAN_ID", nm_setting_vlan_get_id (s_vlan));
+ /* Initscripts use VID instead of VLAN_ID */
+ svSetValueInt64 (ifcfg, "VID", nm_setting_vlan_get_id (s_vlan));
+
/*
* Set the interface name for compatibility with initscripts,
* but add a new variable to indicate the interface name is
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-Test_Write_VLAN_reorder_hdr.cexpected b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-Test_Write_VLAN_reorder_hdr.cexpected
index 592c150132..2346cd484b 100644
--- a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-Test_Write_VLAN_reorder_hdr.cexpected
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-Test_Write_VLAN_reorder_hdr.cexpected
@@ -2,6 +2,7 @@ VLAN=yes
TYPE=Vlan
PHYSDEV=eth0
VLAN_ID=444
+VID=444
DEVICE=eth0.444
NM_IGNORE_DEVICE=yes
REORDER_HDR=yes
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-Vlan_test-vlan-interface.cexpected b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-Vlan_test-vlan-interface.cexpected
index 793713ea61..911d555ef4 100644
--- a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-Vlan_test-vlan-interface.cexpected
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-Vlan_test-vlan-interface.cexpected
@@ -2,6 +2,7 @@ VLAN=yes
TYPE=Vlan
PHYSDEV=eth9
VLAN_ID=43
+VID=43
REORDER_HDR=yes
GVRP=yes
VLAN_FLAGS=LOOSE_BINDING
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-team-slave-enp31s0f1-142.cexpected b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-team-slave-enp31s0f1-142.cexpected
index 87980dc4c7..f107d20846 100644
--- a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-team-slave-enp31s0f1-142.cexpected
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-team-slave-enp31s0f1-142.cexpected
@@ -1,6 +1,7 @@
VLAN=yes
PHYSDEV=enp31s0f1
VLAN_ID=142
+VID=142
REORDER_HDR=yes
GVRP=no
MVRP=no
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-vlan-flags-1 b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-vlan-flags-1
index 5ff8789129..06e5ae1c3a 100644
--- a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-vlan-flags-1
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-vlan-flags-1
@@ -1,7 +1,7 @@
VLAN=yes
TYPE=Vlan
DEVICE=super-vlan
-VLAN_ID=44
+VID=44
PHYSDEV=eth9
REORDER_HDR=yes
GVRP=no