summary refs log tree commit diff
path: root/libnm-core/nm-setting-vlan.c
diff options
context:
space:
mode:
Diffstat (limited to 'libnm-core/nm-setting-vlan.c')
-rw-r--r--libnm-core/nm-setting-vlan.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/libnm-core/nm-setting-vlan.c b/libnm-core/nm-setting-vlan.c
index 61264784..de9c5c48 100644
--- a/libnm-core/nm-setting-vlan.c
+++ b/libnm-core/nm-setting-vlan.c
@@ -290,7 +290,7 @@ nm_setting_vlan_add_priority_str (NMSettingVlan *setting,
  * @setting: the #NMSettingVlan
  * @map: the type of priority map
  *
- * Returns the number of entires in the
+ * Returns the number of entries in the
  * #NMSettingVlan:ingress_priority_map or #NMSettingVlan:egress_priority_map
  * properties of this setting.
  *
@@ -577,7 +577,7 @@ nm_setting_vlan_remove_priority_str_by_value (NMSettingVlan *setting,
  * @setting: the #NMSettingVlan
  * @map: the type of priority map
  *
- * Clear all the entires from #NMSettingVlan:ingress_priority_map or
+ * Clear all the entries from #NMSettingVlan:ingress_priority_map or
  * #NMSettingVlan:egress_priority_map properties.
  */
 void
@@ -600,7 +600,7 @@ nm_setting_vlan_init (NMSettingVlan *setting)
 {
 }
 
-static gboolean
+static int
 verify (NMSetting *setting, NMConnection *connection, GError **error)
 {
 	NMSettingVlanPrivate *priv = NM_SETTING_VLAN_GET_PRIVATE (setting);
@@ -681,6 +681,18 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
 		return FALSE;
 	}
 
+	if (connection && !s_wired) {
+		/* technically, a VLAN setting does not require an ethernet setting. However,
+		 * the ifcfg-rh reader always adds a ethernet setting when reading a vlan setting.
+		 * Thus, in order to be consistent, always add one via normalization. */
+		g_set_error_literal (error,
+		                     NM_CONNECTION_ERROR,
+		                     NM_CONNECTION_ERROR_SETTING_NOT_FOUND,
+		                     _("vlan setting should have a ethernet setting as well"));
+		g_prefix_error (error, "%s.%s: ", NM_SETTING_VLAN_SETTING_NAME, NM_SETTING_VLAN_FLAGS);
+		return NM_SETTING_VERIFY_NORMALIZABLE;
+	}
+
 	return TRUE;
 }