vlan: (all) add VLAN MVRP flag
http://patchwork.ozlabs.org/patch/219364/
This commit is contained in:

committed by
Thomas Haller

parent
93b8871f56
commit
689de5c94a
@@ -738,6 +738,8 @@ vlan_flags_to_string (guint32 flags)
|
||||
g_string_append (flag_str, _("GVRP, "));
|
||||
if (flags & NM_VLAN_FLAG_LOOSE_BINDING)
|
||||
g_string_append (flag_str, _("LOOSE_BINDING, "));
|
||||
if (flags & NM_VLAN_FLAG_MVRP)
|
||||
g_string_append (flag_str, _("MVRP, "));
|
||||
|
||||
if (flag_str->str[flag_str->len-1] == '(')
|
||||
g_string_append (flag_str, _("unknown"));
|
||||
|
@@ -567,9 +567,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
|
||||
}
|
||||
}
|
||||
|
||||
if (priv->flags & ~(NM_VLAN_FLAG_REORDER_HEADERS |
|
||||
NM_VLAN_FLAG_GVRP |
|
||||
NM_VLAN_FLAG_LOOSE_BINDING)) {
|
||||
if (priv->flags & ~NM_VLAN_FLAGS_ALL) {
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
@@ -778,7 +776,8 @@ nm_setting_vlan_class_init (NMSettingVlanClass *setting_class)
|
||||
* interface. Flags include %NM_VLAN_FLAG_REORDER_HEADERS (reordering of
|
||||
* output packet headers), %NM_VLAN_FLAG_GVRP (use of the GVRP protocol),
|
||||
* and %NM_VLAN_FLAG_LOOSE_BINDING (loose binding of the interface to its
|
||||
* master device's operating state).
|
||||
* master device's operating state). %NM_VLAN_FLAG_MVRP (use of the MVRP
|
||||
* protocol).
|
||||
*
|
||||
* The default value of this property is NM_VLAN_FLAG_REORDER_HEADERS,
|
||||
* but it used to be 0. To preserve backward compatibility, the default-value
|
||||
@@ -787,8 +786,8 @@ nm_setting_vlan_class_init (NMSettingVlanClass *setting_class)
|
||||
**/
|
||||
/* ---ifcfg-rh---
|
||||
* property: flags
|
||||
* variable: REORDER_HDR, GVRP, VLAN_FLAGS
|
||||
* values: "yes or "no" for REORDER_HDR and GVRP; "LOOSE_BINDING" for VLAN_FLAGS
|
||||
* variable: REORDER_HDR, GVRP, MVRP, VLAN_FLAGS
|
||||
* values: "yes or "no" for REORDER_HDR, GVRP and MVRP; "LOOSE_BINDING" for VLAN_FLAGS
|
||||
* description: VLAN flags.
|
||||
* ---end---
|
||||
*/
|
||||
|
@@ -79,6 +79,8 @@ typedef enum {
|
||||
* @NM_VLAN_FLAG_LOOSE_BINDING: indicates that this interface's operating
|
||||
* state is tied to the underlying network interface but other details
|
||||
* (like routing) are not.
|
||||
* @NM_VLAN_FLAG_MVRP: indicates that this interface should use MVRP to register
|
||||
* itself with it's switch
|
||||
*
|
||||
* #NMVlanFlags values control the behavior of the VLAN interface.
|
||||
**/
|
||||
@@ -86,10 +88,16 @@ typedef enum { /*< flags >*/
|
||||
NM_VLAN_FLAG_REORDER_HEADERS = 0x1,
|
||||
NM_VLAN_FLAG_GVRP = 0x2,
|
||||
NM_VLAN_FLAG_LOOSE_BINDING = 0x4,
|
||||
NM_VLAN_FLAG_MVRP = 0x8,
|
||||
|
||||
/* NOTE: if adding flags update nm-setting-vlan.c::verify() */
|
||||
} NMVlanFlags;
|
||||
|
||||
#define NM_VLAN_FLAGS_ALL (NM_VLAN_FLAG_REORDER_HEADERS | \
|
||||
NM_VLAN_FLAG_GVRP | \
|
||||
NM_VLAN_FLAG_LOOSE_BINDING | \
|
||||
NM_VLAN_FLAG_MVRP)
|
||||
|
||||
GType nm_setting_vlan_get_type (void);
|
||||
NMSetting *nm_setting_vlan_new (void);
|
||||
|
||||
|
@@ -584,9 +584,7 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
|
||||
}
|
||||
}
|
||||
|
||||
if (priv->flags & ~(NM_VLAN_FLAG_REORDER_HEADERS |
|
||||
NM_VLAN_FLAG_GVRP |
|
||||
NM_VLAN_FLAG_LOOSE_BINDING)) {
|
||||
if (priv->flags & ~NM_VLAN_FLAGS_ALL) {
|
||||
g_set_error_literal (error,
|
||||
NM_SETTING_VLAN_ERROR,
|
||||
NM_SETTING_VLAN_ERROR_INVALID_PROPERTY,
|
||||
@@ -800,7 +798,8 @@ nm_setting_vlan_class_init (NMSettingVlanClass *setting_class)
|
||||
* interface. Flags include %NM_VLAN_FLAG_REORDER_HEADERS (reordering of
|
||||
* output packet headers), %NM_VLAN_FLAG_GVRP (use of the GVRP protocol),
|
||||
* and %NM_VLAN_FLAG_LOOSE_BINDING (loose binding of the interface to its
|
||||
* master device's operating state).
|
||||
* master device's operating state), %NM_VLAN_FLAG_MVRP (use of the MVRP
|
||||
* protocol).
|
||||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_FLAGS,
|
||||
|
@@ -98,6 +98,8 @@ typedef enum {
|
||||
* @NM_VLAN_FLAG_LOOSE_BINDING: indicates that this interface's operating
|
||||
* state is tied to the underlying network interface but other details
|
||||
* (like routing) are not.
|
||||
* @NM_VLAN_FLAG_MVRP: indicates that this interface should use MVRP to register
|
||||
* itself with it's switch
|
||||
*
|
||||
* #NMVlanFlags values control the behavior of the VLAN interface.
|
||||
**/
|
||||
@@ -105,10 +107,16 @@ typedef enum {
|
||||
NM_VLAN_FLAG_REORDER_HEADERS = 0x1,
|
||||
NM_VLAN_FLAG_GVRP = 0x2,
|
||||
NM_VLAN_FLAG_LOOSE_BINDING = 0x4,
|
||||
NM_VLAN_FLAG_MVRP = 0x8,
|
||||
|
||||
/* NOTE: if adding flags update nm-setting-vlan.c::verify() */
|
||||
} NMVlanFlags;
|
||||
|
||||
#define NM_VLAN_FLAGS_ALL (NM_VLAN_FLAG_REORDER_HEADERS | \
|
||||
NM_VLAN_FLAG_GVRP | \
|
||||
NM_VLAN_FLAG_LOOSE_BINDING | \
|
||||
NM_VLAN_FLAG_MVRP)
|
||||
|
||||
GType nm_setting_vlan_get_type (void);
|
||||
NMSetting *nm_setting_vlan_new (void);
|
||||
|
||||
|
@@ -3220,7 +3220,7 @@ vlan_add (NMPlatform *platform,
|
||||
{
|
||||
auto_nl_object struct rtnl_link *rtnllink = (struct rtnl_link *) build_rtnl_link (0, name, NM_LINK_TYPE_VLAN);
|
||||
unsigned int kernel_flags;
|
||||
unsigned int all_flags = VLAN_FLAG_REORDER_HDR | VLAN_FLAG_GVRP | VLAN_FLAG_LOOSE_BINDING;
|
||||
unsigned int all_flags = NM_VLAN_FLAGS_ALL;
|
||||
|
||||
kernel_flags = 0;
|
||||
if (vlan_flags & NM_VLAN_FLAG_REORDER_HEADERS)
|
||||
@@ -3229,6 +3229,9 @@ vlan_add (NMPlatform *platform,
|
||||
kernel_flags |= VLAN_FLAG_GVRP;
|
||||
if (vlan_flags & NM_VLAN_FLAG_LOOSE_BINDING)
|
||||
kernel_flags |= VLAN_FLAG_LOOSE_BINDING;
|
||||
#define VLAN_FLAG_MVRP 0x8
|
||||
if (vlan_flags & NM_VLAN_FLAG_MVRP)
|
||||
kernel_flags |= VLAN_FLAG_MVRP;
|
||||
|
||||
rtnl_link_set_link (rtnllink, parent);
|
||||
rtnl_link_vlan_set_id (rtnllink, vlan_id);
|
||||
|
@@ -4666,6 +4666,9 @@ make_vlan_setting (shvarFile *ifcfg,
|
||||
vlan_flags |= NM_VLAN_FLAG_LOOSE_BINDING;
|
||||
}
|
||||
|
||||
if (svGetValueBoolean (ifcfg, "MVRP", FALSE))
|
||||
vlan_flags |= NM_VLAN_FLAG_MVRP;
|
||||
|
||||
g_object_set (s_vlan, NM_SETTING_VLAN_FLAGS, vlan_flags, NULL);
|
||||
g_free (value);
|
||||
|
||||
|
@@ -1270,6 +1270,8 @@ write_vlan_setting (NMConnection *connection, shvarFile *ifcfg, gboolean *wired,
|
||||
if (vlan_flags & NM_VLAN_FLAG_LOOSE_BINDING)
|
||||
svSetValue (ifcfg, "VLAN_FLAGS", "LOOSE_BINDING", FALSE);
|
||||
|
||||
svSetValue (ifcfg, "MVRP", vlan_flags & NM_VLAN_FLAG_MVRP ? "yes" : "no", FALSE);
|
||||
|
||||
tmp = vlan_priority_maplist_to_stringlist (s_vlan, NM_VLAN_INGRESS_MAP);
|
||||
svSetValue (ifcfg, "VLAN_INGRESS_PRIORITY_MAP", tmp, FALSE);
|
||||
g_free (tmp);
|
||||
|
Reference in New Issue
Block a user