libnm-core: add multicast-snooping property to bridge setting

This commit is contained in:
Jiří Klimeš 2015-02-20 12:32:23 +01:00
parent d7f977eba8
commit 11efde3b40
3 changed files with 56 additions and 1 deletions

View file

@ -53,6 +53,7 @@ typedef struct {
guint16 hello_time;
guint16 max_age;
guint32 ageing_time;
gboolean multicast_snooping;
} NMSettingBridgePrivate;
enum {
@ -64,6 +65,7 @@ enum {
PROP_HELLO_TIME,
PROP_MAX_AGE,
PROP_AGEING_TIME,
PROP_MULTICAST_SNOOPING,
LAST_PROP
};
@ -178,6 +180,22 @@ nm_setting_bridge_get_ageing_time (NMSettingBridge *setting)
return NM_SETTING_BRIDGE_GET_PRIVATE (setting)->ageing_time;
}
/**
* nm_setting_bridge_get_multicast_snooping:
* @setting: the #NMSettingBridge
*
* Returns: the #NMSettingBridge:multicast-snooping property of the setting
*
* Since: 1.2
**/
gboolean
nm_setting_bridge_get_multicast_snooping (NMSettingBridge *setting)
{
g_return_val_if_fail (NM_IS_SETTING_BRIDGE (setting), FALSE);
return NM_SETTING_BRIDGE_GET_PRIVATE (setting)->multicast_snooping;
}
/* IEEE 802.1D-1998 timer values */
#define BR_MIN_HELLO_TIME 1
#define BR_MAX_HELLO_TIME 10
@ -309,6 +327,9 @@ set_property (GObject *object, guint prop_id,
case PROP_AGEING_TIME:
priv->ageing_time = g_value_get_uint (value);
break;
case PROP_MULTICAST_SNOOPING:
priv->multicast_snooping = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -344,6 +365,9 @@ get_property (GObject *object, guint prop_id,
case PROP_AGEING_TIME:
g_value_set_uint (value, priv->ageing_time);
break;
case PROP_MULTICAST_SNOOPING:
g_value_set_boolean (value, priv->multicast_snooping);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -533,6 +557,33 @@ nm_setting_bridge_class_init (NMSettingBridgeClass *setting_class)
NM_SETTING_PARAM_INFERRABLE |
G_PARAM_STATIC_STRINGS));
/**
* NMSettingBridge:multicast-snooping:
*
* 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.
*
* Since: 1.2
**/
/* ---ifcfg-rh---
* property: multicast-snooping
* variable: BRIDGING_OPTS: multicast_snooping=
* values: 0 or 1
* default: 1
* description: IGMP snooping support.
* ---end---
*/
g_object_class_install_property
(object_class, PROP_MULTICAST_SNOOPING,
g_param_spec_boolean (NM_SETTING_BRIDGE_MULTICAST_SNOOPING, "", "",
TRUE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
NM_SETTING_PARAM_INFERRABLE |
G_PARAM_STATIC_STRINGS));
/* ---dbus---
* property: interface-name
* format: string

View file

@ -16,7 +16,7 @@
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
* Copyright 2011 - 2012 Red Hat, Inc.
* Copyright 2011 - 2015 Red Hat, Inc.
*/
#ifndef __NM_SETTING_BRIDGE_H__
@ -46,6 +46,7 @@ G_BEGIN_DECLS
#define NM_SETTING_BRIDGE_HELLO_TIME "hello-time"
#define NM_SETTING_BRIDGE_MAX_AGE "max-age"
#define NM_SETTING_BRIDGE_AGEING_TIME "ageing-time"
#define NM_SETTING_BRIDGE_MULTICAST_SNOOPING "multicast-snooping"
struct _NMSettingBridge {
NMSetting parent;
@ -76,6 +77,8 @@ guint16 nm_setting_bridge_get_max_age (NMSettingBridge *setting);
guint32 nm_setting_bridge_get_ageing_time (NMSettingBridge *setting);
gboolean nm_setting_bridge_get_multicast_snooping (NMSettingBridge *setting);
G_END_DECLS
#endif /* __NM_SETTING_BRIDGE_H__ */

View file

@ -848,6 +848,7 @@ local:
libnm_1_2_0 {
global:
nm_setting_bridge_get_multicast_snooping;
nm_utils_bond_mode_int_to_string;
nm_utils_bond_mode_string_to_int;
} libnm_1_0_0;