From cefc99ee5a04809ad4dad341887de74046b60ef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= Date: Thu, 27 Aug 2015 17:24:36 +0200 Subject: libnm/vlan: default to vlan.flags=REORDER_HDR for new connection (rh #1250225) The kernel defaults REORDER_HDR to 1 when creating a new VLAN, but NetworkManager's VLAN flags property defaults to 0 and thus REORDER_HDR is not set by default for default NM created VLANs. We want to match kernel defaults (only for newly created connection). So we set REORDER_HDR if the flag is not present in D-Bus hash. https://bugzilla.redhat.com/show_bug.cgi?id=1250225 --- libnm-core/nm-setting-vlan.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/libnm-core/nm-setting-vlan.c b/libnm-core/nm-setting-vlan.c index dd3746a83d..cbdc0a1bf4 100644 --- a/libnm-core/nm-setting-vlan.c +++ b/libnm-core/nm-setting-vlan.c @@ -558,6 +558,20 @@ verify (NMSetting *setting, NMConnection *connection, GError **error) return TRUE; } +static void +nm_setting_vlan_no_flags (NMSetting *setting, + GVariant *connection_dict, + const char *property) +{ + /* We want to default to REORDER_HDR flag in order to be compatible + * with kernel default setting, see rh #1250225. */ + guint32 flags = NM_VLAN_FLAG_REORDER_HEADERS; + + g_object_set (G_OBJECT (setting), + NM_SETTING_VLAN_FLAGS, flags, + NULL); +} + static GSList * priority_strv_to_maplist (NMVlanPriorityMap map, char **strv) { @@ -753,6 +767,11 @@ nm_setting_vlan_class_init (NMSettingVlanClass *setting_class) G_PARAM_CONSTRUCT | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS)); + _nm_setting_class_override_property (parent_class, NM_SETTING_VLAN_FLAGS, + NULL, + NULL, + NULL, + nm_setting_vlan_no_flags); /** * NMSettingVlan:ingress-priority-map: -- cgit v1.2.1