diff options
author | Antonio Cardace <acardace@redhat.com> | 2020-03-30 13:50:35 +0200 |
---|---|---|
committer | Antonio Cardace <acardace@redhat.com> | 2020-04-06 09:56:11 +0200 |
commit | ad052c3d672f9658c1d4cb47d58ec574a79ac716 (patch) | |
tree | 51e70eafdbbfcc2719667b16cef07f78552cf8dd | |
parent | a685cce70ad89d68430b03e9b47e3eb487c15b49 (diff) | |
download | NetworkManager-ad052c3d672f9658c1d4cb47d58ec574a79ac716.tar.gz |
nm-setting-bridge: add 'multicast-querier' bridge optionac/bridge_options
https://bugzilla.redhat.com/show_bug.cgi?id=1755768
-rw-r--r-- | clients/common/nm-meta-setting-desc.c | 3 | ||||
-rw-r--r-- | clients/common/settings-docs.h.in | 1 | ||||
-rw-r--r-- | libnm-core/nm-setting-bridge.c | 47 | ||||
-rw-r--r-- | libnm-core/nm-setting-bridge.h | 4 | ||||
-rw-r--r-- | libnm/libnm.ver | 1 | ||||
-rw-r--r-- | src/devices/nm-device-bridge.c | 4 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c | 1 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c | 7 |
8 files changed, 68 insertions, 0 deletions
diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c index 536a1506df..03f9b313ce 100644 --- a/clients/common/nm-meta-setting-desc.c +++ b/clients/common/nm-meta-setting-desc.c @@ -4899,6 +4899,9 @@ static const NMMetaPropertyInfo *const property_infos_BRIDGE[] = { .prompt = N_("Group forward mask [0]"), .property_type = &_pt_gobject_int, ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_MULTICAST_QUERIER, + .property_type = &_pt_gobject_bool, + ), PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_MULTICAST_QUERY_USE_IFADDR, .property_type = &_pt_gobject_bool, ), diff --git a/clients/common/settings-docs.h.in b/clients/common/settings-docs.h.in index a3e7401282..5cbef4285f 100644 --- a/clients/common/settings-docs.h.in +++ b/clients/common/settings-docs.h.in @@ -119,6 +119,7 @@ #define DESCRIBE_DOC_NM_SETTING_BRIDGE_HELLO_TIME N_("The Spanning Tree Protocol (STP) hello time, in seconds.") #define DESCRIBE_DOC_NM_SETTING_BRIDGE_MAC_ADDRESS N_("If specified, the MAC address of bridge. When creating a new bridge, this MAC address will be set. If this field is left unspecified, the \"ethernet.cloned-mac-address\" is referred instead to generate the initial MAC address. Note that setting \"ethernet.cloned-mac-address\" anyway overwrites the MAC address of the bridge later while activating the bridge. Hence, this property is deprecated. Deprecated: 1") #define DESCRIBE_DOC_NM_SETTING_BRIDGE_MAX_AGE N_("The Spanning Tree Protocol (STP) maximum message age, in seconds.") +#define DESCRIBE_DOC_NM_SETTING_BRIDGE_MULTICAST_QUERIER N_("Enable or disable sending of multicast queries by the bridge. If not specified the option is disabled.") #define DESCRIBE_DOC_NM_SETTING_BRIDGE_MULTICAST_QUERY_USE_IFADDR N_("If enabled the bridge's own IP address is used as the source address for IGMP queries otherwise the default of 0.0.0.0 is used.") #define DESCRIBE_DOC_NM_SETTING_BRIDGE_MULTICAST_ROUTER N_("Sets bridge's multicast router. multicast-snooping must be enabled for this option to work. Supported values are: 'auto', 'disabled', 'enabled'. If not specified the default value is 'auto'.") #define DESCRIBE_DOC_NM_SETTING_BRIDGE_MULTICAST_SNOOPING N_("Controls whether IGMP snooping is enabled for this bridge. Note that if snooping was automatically disabled due to hash collisions, the system may refuse to enable the feature until the collisions are resolved.") diff --git a/libnm-core/nm-setting-bridge.c b/libnm-core/nm-setting-bridge.c index 7ee8fe38c7..d800022168 100644 --- a/libnm-core/nm-setting-bridge.c +++ b/libnm-core/nm-setting-bridge.c @@ -26,6 +26,7 @@ #define BRIDGE_FORWARD_DELAY_DEFAULT 15 #define BRIDGE_HELLO_TIME_DEFAULT 2 #define BRIDGE_MAX_AGE_DEFAULT 20 +#define BRIDGE_MULTICAST_QUERIER_DEFAULT FALSE #define BRIDGE_MULTICAST_QUERY_USE_IFADDR_DEFAULT FALSE #define BRIDGE_MULTICAST_SNOOPING_DEFAULT TRUE #define BRIDGE_PRIORITY_DEFAULT 0x8000 @@ -46,6 +47,7 @@ NM_GOBJECT_PROPERTIES_DEFINE (NMSettingBridge, PROP_GROUP_ADDRESS, PROP_GROUP_FORWARD_MASK, PROP_MULTICAST_ROUTER, + PROP_MULTICAST_QUERIER, PROP_MULTICAST_QUERY_USE_IFADDR, PROP_MULTICAST_SNOOPING, PROP_VLAN_FILTERING, @@ -73,6 +75,7 @@ typedef struct { bool stp:1; bool vlan_stats_enabled:1; bool multicast_query_use_ifaddr:1; + bool multicast_querier:1; } NMSettingBridgePrivate; /** @@ -990,6 +993,23 @@ nm_setting_bridge_get_multicast_query_use_ifaddr (const NMSettingBridge *setting return NM_SETTING_BRIDGE_GET_PRIVATE (setting)->multicast_query_use_ifaddr; } + +/** + * nm_setting_bridge_get_multicast_querier: + * @setting: the #NMSettingBridge + * + * Returns: the #NMSettingBridge:multicast-querier property of the setting + * + * Since 1.24 + **/ +gboolean +nm_setting_bridge_get_multicast_querier (const NMSettingBridge *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_BRIDGE (setting), FALSE); + + return NM_SETTING_BRIDGE_GET_PRIVATE (setting)->multicast_querier; +} + /*****************************************************************************/ static gboolean @@ -1221,6 +1241,9 @@ get_property (GObject *object, guint prop_id, case PROP_MULTICAST_ROUTER: g_value_set_string (value, priv->multicast_router); break; + case PROP_MULTICAST_QUERIER: + g_value_set_boolean (value, priv->multicast_querier); + break; case PROP_MULTICAST_QUERY_USE_IFADDR: g_value_set_boolean (value, priv->multicast_query_use_ifaddr); break; @@ -1292,6 +1315,9 @@ set_property (GObject *object, guint prop_id, g_free (priv->multicast_router); priv->multicast_router = g_value_dup_string (value); break; + case PROP_MULTICAST_QUERIER: + priv->multicast_querier = g_value_get_boolean (value); + break; case PROP_MULTICAST_QUERY_USE_IFADDR: priv->multicast_query_use_ifaddr = g_value_get_boolean (value); break; @@ -1339,6 +1365,7 @@ nm_setting_bridge_init (NMSettingBridge *setting) priv->vlan_default_pvid = BRIDGE_VLAN_DEFAULT_PVID_DEFAULT; priv->vlan_stats_enabled = BRIDGE_VLAN_STATS_ENABLED_DEFAULT; priv->multicast_query_use_ifaddr = BRIDGE_MULTICAST_QUERY_USE_IFADDR_DEFAULT; + priv->multicast_querier = BRIDGE_MULTICAST_QUERIER_DEFAULT; } /** @@ -1786,6 +1813,26 @@ nm_setting_bridge_class_init (NMSettingBridgeClass *klass) NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS); + /** + * NMSettingBridge:multicast-querier: + * + * Enable or disable sending of multicast queries by the bridge. + * If not specified the option is disabled. + **/ + /* ---ifcfg-rh--- + * property: multicast-querier + * variable: BRIDGING_OPTS: multicast_querier= + * default: 0 + * example: BRIDGING_OPTS="multicast_querier=1" + * ---end--- + */ + obj_properties[PROP_MULTICAST_QUERIER] = + g_param_spec_boolean (NM_SETTING_BRIDGE_MULTICAST_QUERIER, "", "", + BRIDGE_MULTICAST_QUERIER_DEFAULT, + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS); + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); _nm_setting_class_commit_full (setting_class, NM_META_SETTING_TYPE_BRIDGE, diff --git a/libnm-core/nm-setting-bridge.h b/libnm-core/nm-setting-bridge.h index fecd24aa52..6bd5100f26 100644 --- a/libnm-core/nm-setting-bridge.h +++ b/libnm-core/nm-setting-bridge.h @@ -33,6 +33,7 @@ G_BEGIN_DECLS #define NM_SETTING_BRIDGE_GROUP_FORWARD_MASK "group-forward-mask" #define NM_SETTING_BRIDGE_MULTICAST_SNOOPING "multicast-snooping" #define NM_SETTING_BRIDGE_MULTICAST_ROUTER "multicast-router" +#define NM_SETTING_BRIDGE_MULTICAST_QUERIER "multicast-querier" #define NM_SETTING_BRIDGE_MULTICAST_QUERY_USE_IFADDR "multicast-query-use-ifaddr" #define NM_SETTING_BRIDGE_VLAN_FILTERING "vlan-filtering" #define NM_SETTING_BRIDGE_VLAN_DEFAULT_PVID "vlan-default-pvid" @@ -136,6 +137,9 @@ const char * nm_setting_bridge_get_multicast_router (const NMSettingBridge *se NM_AVAILABLE_IN_1_24 gboolean nm_setting_bridge_get_multicast_query_use_ifaddr (const NMSettingBridge *setting); +NM_AVAILABLE_IN_1_24 +gboolean nm_setting_bridge_get_multicast_querier (const NMSettingBridge *setting); + G_END_DECLS #endif /* __NM_SETTING_BRIDGE_H__ */ diff --git a/libnm/libnm.ver b/libnm/libnm.ver index f13dbb6ab3..b5ce8c34a3 100644 --- a/libnm/libnm.ver +++ b/libnm/libnm.ver @@ -1686,6 +1686,7 @@ global: nm_setting_802_1x_get_phase2_domain_match; nm_setting_bond_get_option_normalized; nm_setting_bridge_get_group_address; + nm_setting_bridge_get_multicast_querier; nm_setting_bridge_get_multicast_query_use_ifaddr; nm_setting_bridge_get_multicast_router; nm_setting_bridge_get_vlan_protocol; diff --git a/src/devices/nm-device-bridge.c b/src/devices/nm-device-bridge.c index 12448f4700..6eb9850e45 100644 --- a/src/devices/nm-device-bridge.c +++ b/src/devices/nm-device-bridge.c @@ -274,6 +274,10 @@ static const Option master_options[] = { NULL, NULL, 0, 0xFFFF, 0, TRUE, FALSE, FALSE }, + { NM_SETTING_BRIDGE_MULTICAST_QUERIER, "multicast_querier", + NULL, NULL, + 0, 1, 0, + FALSE, FALSE, FALSE }, { NM_SETTING_BRIDGE_MULTICAST_QUERY_USE_IFADDR, "multicast_query_use_ifaddr", NULL, NULL, 0, 1, 0, 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 7bc5517802..8e15341238 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c @@ -5157,6 +5157,7 @@ handle_bridge_option (NMSetting *setting, { "hello_time", NM_SETTING_BRIDGE_HELLO_TIME, BRIDGE_OPT_TYPE_OPTION, .only_with_stp = TRUE }, { "max_age", NM_SETTING_BRIDGE_MAX_AGE, BRIDGE_OPT_TYPE_OPTION, .only_with_stp = TRUE }, { "ageing_time", NM_SETTING_BRIDGE_AGEING_TIME, BRIDGE_OPT_TYPE_OPTION }, + { "multicast_querier", NM_SETTING_BRIDGE_MULTICAST_QUERIER, BRIDGE_OPT_TYPE_OPTION }, { "multicast_query_use_ifaddr", NM_SETTING_BRIDGE_MULTICAST_QUERY_USE_IFADDR, BRIDGE_OPT_TYPE_OPTION }, { "multicast_snooping", NM_SETTING_BRIDGE_MULTICAST_SNOOPING, BRIDGE_OPT_TYPE_OPTION }, { "multicast_router", NM_SETTING_BRIDGE_MULTICAST_ROUTER, BRIDGE_OPT_TYPE_OPTION }, 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 504f10f364..a0797fdc79 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c @@ -1501,6 +1501,13 @@ write_bridge_setting (NMConnection *connection, shvarFile *ifcfg, gboolean *wire g_string_append_printf (opts, "group_fwd_mask=%u", i); } + b = nm_setting_bridge_get_multicast_querier (s_bridge); + if (b != get_setting_default_boolean (NM_SETTING (s_bridge), NM_SETTING_BRIDGE_MULTICAST_QUERIER)) { + if (opts->len) + g_string_append_c (opts, ' '); + g_string_append_printf (opts, "multicast_querier=%u", (guint) b); + } + b = nm_setting_bridge_get_multicast_query_use_ifaddr (s_bridge); if (b != get_setting_default_boolean (NM_SETTING (s_bridge), NM_SETTING_BRIDGE_MULTICAST_QUERY_USE_IFADDR)) { if (opts->len) |