mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-04 11:00:18 +01:00
merge: add 'multicast_snooping' bridge option to NetworkManager (bgo #744853)
https://bugzilla.gnome.org/show_bug.cgi?id=744853
This commit is contained in:
commit
af509459c6
13 changed files with 153 additions and 18 deletions
|
|
@ -386,6 +386,7 @@ usage_connection_add (void)
|
|||
" [hello-time <1-10>]\n"
|
||||
" [max-age <6-40>]\n"
|
||||
" [ageing-time <0-1000000>]\n"
|
||||
" [multicast-snooping yes|no]\n"
|
||||
" [mac <MAC address>]\n\n"
|
||||
" bridge-slave: master <master (ifname, or connection UUID or name)>\n"
|
||||
" [priority <0-63>]\n"
|
||||
|
|
@ -3811,14 +3812,14 @@ do_questionnaire_team_slave (char **config)
|
|||
|
||||
static void
|
||||
do_questionnaire_bridge (char **stp, char **priority, char **fwd_delay, char **hello_time,
|
||||
char **max_age, char **ageing_time, char **mac)
|
||||
char **max_age, char **ageing_time, char **mcast_snoop, char **mac)
|
||||
{
|
||||
unsigned long tmp;
|
||||
gboolean once_more;
|
||||
GError *error = NULL;
|
||||
|
||||
/* Ask for optional 'bridge' arguments. */
|
||||
if (!want_provide_opt_args (_("bridge"), 7))
|
||||
if (!want_provide_opt_args (_("bridge"), 8))
|
||||
return;
|
||||
|
||||
if (!*stp) {
|
||||
|
|
@ -3896,6 +3897,20 @@ do_questionnaire_bridge (char **stp, char **priority, char **fwd_delay, char **h
|
|||
}
|
||||
} while (once_more);
|
||||
}
|
||||
if (!*mcast_snoop) {
|
||||
gboolean mcast_snoop_bool;
|
||||
do {
|
||||
*mcast_snoop = nmc_readline (_("Enable IGMP snooping %s"), prompt_yes_no (TRUE, ":"));
|
||||
*mcast_snoop = *mcast_snoop ? *mcast_snoop : g_strdup ("yes");
|
||||
normalize_yes_no (mcast_snoop);
|
||||
once_more = !nmc_string_to_bool (*mcast_snoop, &mcast_snoop_bool, &error);
|
||||
if (once_more) {
|
||||
g_print (_("Error: 'multicast-snooping': %s.\n"), error->message);
|
||||
g_clear_error (&error);
|
||||
g_free (*mcast_snoop);
|
||||
}
|
||||
} while (once_more);
|
||||
}
|
||||
if (!*mac) {
|
||||
do {
|
||||
*mac = nmc_get_user_input (_("MAC [none]: "));
|
||||
|
|
@ -5045,7 +5060,9 @@ cleanup_team_slave:
|
|||
char *max_age = NULL;
|
||||
const char *ageing_time_c = NULL;
|
||||
char *ageing_time = NULL;
|
||||
gboolean stp_bool;
|
||||
const char *mcast_snoop_c = NULL;
|
||||
char *mcast_snoop = NULL;
|
||||
gboolean stp_bool, mcast_snoop_bool;
|
||||
unsigned long stp_prio_int, fwd_delay_int, hello_time_int,
|
||||
max_age_int, ageing_time_int;
|
||||
const char *mac_c = NULL;
|
||||
|
|
@ -5056,6 +5073,7 @@ cleanup_team_slave:
|
|||
{"hello-time", TRUE, &hello_time_c, FALSE},
|
||||
{"max-age", TRUE, &max_age_c, FALSE},
|
||||
{"ageing-time", TRUE, &ageing_time_c, FALSE},
|
||||
{"multicast-snooping", TRUE, &mcast_snoop_c, FALSE},
|
||||
{"mac", TRUE, &mac_c, FALSE},
|
||||
{NULL} };
|
||||
|
||||
|
|
@ -5069,10 +5087,11 @@ cleanup_team_slave:
|
|||
hello_time = g_strdup (hello_time_c);
|
||||
max_age = g_strdup (max_age_c);
|
||||
ageing_time = g_strdup (ageing_time_c);
|
||||
mcast_snoop = g_strdup (mcast_snoop_c);
|
||||
mac = g_strdup (mac_c);
|
||||
if (ask)
|
||||
do_questionnaire_bridge (&stp, &priority, &fwd_delay, &hello_time,
|
||||
&max_age, &ageing_time, &mac);
|
||||
&max_age, &ageing_time, &mcast_snoop, &mac);
|
||||
|
||||
/* Generate ifname if conneciton doesn't have one */
|
||||
ifname = nm_setting_connection_get_interface_name (s_con);
|
||||
|
|
@ -5094,6 +5113,15 @@ cleanup_team_slave:
|
|||
goto cleanup_bridge;
|
||||
}
|
||||
}
|
||||
if (mcast_snoop) {
|
||||
GError *tmp_err = NULL;
|
||||
if (!nmc_string_to_bool (mcast_snoop, &mcast_snoop_bool, &tmp_err)) {
|
||||
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
|
||||
_("Error: 'multicast-snooping': %s."), tmp_err->message);
|
||||
g_clear_error (&tmp_err);
|
||||
goto cleanup_bridge;
|
||||
}
|
||||
}
|
||||
|
||||
/* Add 'bond' setting */
|
||||
/* Must be done *before* bridge_prop_string_to_uint() so that the type is known */
|
||||
|
|
@ -5136,6 +5164,8 @@ cleanup_team_slave:
|
|||
g_object_set (s_bridge, NM_SETTING_BRIDGE_MAX_AGE, max_age_int, NULL);
|
||||
if (ageing_time)
|
||||
g_object_set (s_bridge, NM_SETTING_BRIDGE_AGEING_TIME, ageing_time_int, NULL);
|
||||
if (mcast_snoop)
|
||||
g_object_set (s_bridge, NM_SETTING_BRIDGE_MULTICAST_SNOOPING, mcast_snoop_bool, NULL);
|
||||
if (mac)
|
||||
g_object_set (s_bridge, NM_SETTING_BRIDGE_MAC_ADDRESS, mac, NULL);
|
||||
|
||||
|
|
@ -5147,6 +5177,7 @@ cleanup_bridge:
|
|||
g_free (hello_time);
|
||||
g_free (max_age);
|
||||
g_free (ageing_time);
|
||||
g_free (mcast_snoop);
|
||||
g_free (mac);
|
||||
if (!success)
|
||||
return FALSE;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright 2010 - 2014 Red Hat, Inc.
|
||||
* Copyright 2010 - 2015 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
|
@ -578,6 +578,7 @@ NmcOutputField nmc_fields_setting_bridge[] = {
|
|||
SETTING_FIELD (NM_SETTING_BRIDGE_HELLO_TIME, 6), /* 5 */
|
||||
SETTING_FIELD (NM_SETTING_BRIDGE_MAX_AGE, 6), /* 6 */
|
||||
SETTING_FIELD (NM_SETTING_BRIDGE_AGEING_TIME, 6), /* 7 */
|
||||
SETTING_FIELD (NM_SETTING_BRIDGE_MULTICAST_SNOOPING, 6), /* 8 */
|
||||
{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
|
||||
};
|
||||
#define NMC_FIELDS_SETTING_BRIDGE_ALL "name"","\
|
||||
|
|
@ -587,7 +588,8 @@ NmcOutputField nmc_fields_setting_bridge[] = {
|
|||
NM_SETTING_BRIDGE_FORWARD_DELAY","\
|
||||
NM_SETTING_BRIDGE_HELLO_TIME","\
|
||||
NM_SETTING_BRIDGE_MAX_AGE","\
|
||||
NM_SETTING_BRIDGE_AGEING_TIME
|
||||
NM_SETTING_BRIDGE_AGEING_TIME","\
|
||||
NM_SETTING_BRIDGE_MULTICAST_SNOOPING
|
||||
#define NMC_FIELDS_SETTING_BRIDGE_COMMON NMC_FIELDS_SETTING_BRIDGE_ALL
|
||||
|
||||
/* Available fields for NM_SETTING_BRIDGE_PORT_SETTING_NAME */
|
||||
|
|
@ -996,6 +998,7 @@ DEFINE_GETTER (nmc_property_bridge_get_forward_delay, NM_SETTING_BRIDGE_FORWARD_
|
|||
DEFINE_GETTER (nmc_property_bridge_get_hello_time, NM_SETTING_BRIDGE_HELLO_TIME)
|
||||
DEFINE_GETTER (nmc_property_bridge_get_max_age, NM_SETTING_BRIDGE_MAX_AGE)
|
||||
DEFINE_GETTER (nmc_property_bridge_get_ageing_time, NM_SETTING_BRIDGE_AGEING_TIME)
|
||||
DEFINE_GETTER (nmc_property_bridge_get_multicast_snooping, NM_SETTING_BRIDGE_MULTICAST_SNOOPING)
|
||||
|
||||
/* --- NM_SETTING_BRIDGE_PORT_SETTING_NAME property get functions --- */
|
||||
DEFINE_GETTER (nmc_property_bridge_port_get_priority, NM_SETTING_BRIDGE_PORT_PRIORITY)
|
||||
|
|
@ -5146,6 +5149,14 @@ nmc_properties_init (void)
|
|||
NULL,
|
||||
NULL);
|
||||
|
||||
nmc_add_prop_funcs (GLUE (BRIDGE, MULTICAST_SNOOPING),
|
||||
nmc_property_bridge_get_multicast_snooping,
|
||||
nmc_property_set_bool,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
/* Add editable properties for NM_SETTING_BRIDGE_PORT_SETTING_NAME */
|
||||
nmc_add_prop_funcs (GLUE (BRIDGE_PORT, PRIORITY),
|
||||
nmc_property_bridge_port_get_priority,
|
||||
|
|
@ -7350,6 +7361,7 @@ setting_bridge_details (NMSetting *setting, NmCli *nmc, const char *one_prop, g
|
|||
set_val_str (arr, 5, nmc_property_bridge_get_hello_time (setting));
|
||||
set_val_str (arr, 6, nmc_property_bridge_get_max_age (setting));
|
||||
set_val_str (arr, 7, nmc_property_bridge_get_ageing_time (setting));
|
||||
set_val_str (arr, 8, nmc_property_bridge_get_multicast_snooping (setting));
|
||||
g_ptr_array_add (nmc->output_data, arr);
|
||||
|
||||
print_data (nmc); /* Print all data */
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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__ */
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -605,6 +605,8 @@ The value can be prefixed with \fBifname/\fP, \fBuuid/\fP or \fBid/\fP to disamb
|
|||
\(en STP maximum message age, in seconds (default: 20)
|
||||
.IP "\fI[ageing-time <0-1000000>]\fP" 42
|
||||
\(en the Ethernet MAC address aging time, in seconds (default: 300)
|
||||
.IP "\fI[multicast-snooping yes|no]\fP" 42
|
||||
\(en controls whether IGMP snooping is enabled (default: yes)
|
||||
.IP "\fI[mac <MAC address>]\fP" 42
|
||||
\(en MAC address of the bridge (note: this requires a recent kernel feature,
|
||||
originally introduced in 3.15 upstream kernel)
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* with this program; if not, write to the 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.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
|
@ -158,6 +158,7 @@ static const Option master_options[] = {
|
|||
{ NM_SETTING_BRIDGE_HELLO_TIME, "hello_time", TRUE, TRUE },
|
||||
{ NM_SETTING_BRIDGE_MAX_AGE, "max_age", TRUE, TRUE },
|
||||
{ NM_SETTING_BRIDGE_AGEING_TIME, "ageing_time", TRUE, TRUE },
|
||||
{ NM_SETTING_BRIDGE_MULTICAST_SNOOPING, "multicast_snooping", FALSE, FALSE },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright 2008 - 2014 Red Hat, Inc.
|
||||
* Copyright 2008 - 2015 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
|
@ -4092,6 +4092,12 @@ handle_bridge_option (NMSetting *setting,
|
|||
g_object_set (setting, NM_SETTING_BRIDGE_AGEING_TIME, u, NULL);
|
||||
else
|
||||
PARSE_WARNING ("invalid ageing_time value '%s'", value);
|
||||
} else if (!strcmp (key, "multicast_snooping")) {
|
||||
if (get_uint (value, &u))
|
||||
g_object_set (setting, NM_SETTING_BRIDGE_MULTICAST_SNOOPING,
|
||||
(gboolean) u, NULL);
|
||||
else
|
||||
PARSE_WARNING ("invalid multicast_snooping value '%s'", value);
|
||||
} else
|
||||
PARSE_WARNING ("unhandled bridge option '%s'", key);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,5 +4,5 @@ TYPE=Bridge
|
|||
BOOTPROTO=dhcp
|
||||
STP=on
|
||||
DELAY=2
|
||||
BRIDGING_OPTS="priority=32744 hello_time=7 max_age=39 ageing_time=235352"
|
||||
BRIDGING_OPTS="priority=32744 hello_time=7 max_age=39 ageing_time=235352 multicast_snooping=0"
|
||||
MACADDR=00:16:41:11:22:33
|
||||
|
|
|
|||
|
|
@ -10369,6 +10369,7 @@ test_read_bridge_main (void)
|
|||
g_assert_cmpuint (nm_setting_bridge_get_hello_time (s_bridge), ==, 7);
|
||||
g_assert_cmpuint (nm_setting_bridge_get_max_age (s_bridge), ==, 39);
|
||||
g_assert_cmpuint (nm_setting_bridge_get_ageing_time (s_bridge), ==, 235352);
|
||||
g_assert (!nm_setting_bridge_get_multicast_snooping (s_bridge));
|
||||
|
||||
/* MAC address */
|
||||
mac = nm_setting_bridge_get_mac_address (s_bridge);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright 2009 - 2014 Red Hat, Inc.
|
||||
* Copyright 2009 - 2015 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
|
@ -1317,7 +1317,7 @@ write_team_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
|||
}
|
||||
|
||||
static guint32
|
||||
get_setting_default (NMSetting *setting, const char *prop)
|
||||
get_setting_default_uint (NMSetting *setting, const char *prop)
|
||||
{
|
||||
GParamSpec *pspec;
|
||||
GValue val = G_VALUE_INIT;
|
||||
|
|
@ -1333,12 +1333,30 @@ get_setting_default (NMSetting *setting, const char *prop)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
get_setting_default_boolean (NMSetting *setting, const char *prop)
|
||||
{
|
||||
GParamSpec *pspec;
|
||||
GValue val = G_VALUE_INIT;
|
||||
gboolean ret = 0;
|
||||
|
||||
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (setting), prop);
|
||||
g_assert (pspec);
|
||||
g_value_init (&val, pspec->value_type);
|
||||
g_param_value_set_default (pspec, &val);
|
||||
g_assert (G_VALUE_HOLDS_BOOLEAN (&val));
|
||||
ret = g_value_get_boolean (&val);
|
||||
g_value_unset (&val);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
write_bridge_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
||||
{
|
||||
NMSettingBridge *s_bridge;
|
||||
const char *iface;
|
||||
guint32 i;
|
||||
gboolean b;
|
||||
GString *opts;
|
||||
const char *mac;
|
||||
char *s;
|
||||
|
|
@ -1372,7 +1390,7 @@ write_bridge_setting (NMConnection *connection, shvarFile *ifcfg, GError **error
|
|||
svSetValue (ifcfg, "STP", "yes", FALSE);
|
||||
|
||||
i = nm_setting_bridge_get_forward_delay (s_bridge);
|
||||
if (i != get_setting_default (NM_SETTING (s_bridge), NM_SETTING_BRIDGE_FORWARD_DELAY)) {
|
||||
if (i != get_setting_default_uint (NM_SETTING (s_bridge), NM_SETTING_BRIDGE_FORWARD_DELAY)) {
|
||||
s = g_strdup_printf ("%u", i);
|
||||
svSetValue (ifcfg, "DELAY", s, FALSE);
|
||||
g_free (s);
|
||||
|
|
@ -1381,14 +1399,14 @@ write_bridge_setting (NMConnection *connection, shvarFile *ifcfg, GError **error
|
|||
g_string_append_printf (opts, "priority=%u", nm_setting_bridge_get_priority (s_bridge));
|
||||
|
||||
i = nm_setting_bridge_get_hello_time (s_bridge);
|
||||
if (i != get_setting_default (NM_SETTING (s_bridge), NM_SETTING_BRIDGE_HELLO_TIME)) {
|
||||
if (i != get_setting_default_uint (NM_SETTING (s_bridge), NM_SETTING_BRIDGE_HELLO_TIME)) {
|
||||
if (opts->len)
|
||||
g_string_append_c (opts, ' ');
|
||||
g_string_append_printf (opts, "hello_time=%u", i);
|
||||
}
|
||||
|
||||
i = nm_setting_bridge_get_max_age (s_bridge);
|
||||
if (i != get_setting_default (NM_SETTING (s_bridge), NM_SETTING_BRIDGE_MAX_AGE)) {
|
||||
if (i != get_setting_default_uint (NM_SETTING (s_bridge), NM_SETTING_BRIDGE_MAX_AGE)) {
|
||||
if (opts->len)
|
||||
g_string_append_c (opts, ' ');
|
||||
g_string_append_printf (opts, "max_age=%u", i);
|
||||
|
|
@ -1396,12 +1414,19 @@ write_bridge_setting (NMConnection *connection, shvarFile *ifcfg, GError **error
|
|||
}
|
||||
|
||||
i = nm_setting_bridge_get_ageing_time (s_bridge);
|
||||
if (i != get_setting_default (NM_SETTING (s_bridge), NM_SETTING_BRIDGE_AGEING_TIME)) {
|
||||
if (i != get_setting_default_uint (NM_SETTING (s_bridge), NM_SETTING_BRIDGE_AGEING_TIME)) {
|
||||
if (opts->len)
|
||||
g_string_append_c (opts, ' ');
|
||||
g_string_append_printf (opts, "ageing_time=%u", i);
|
||||
}
|
||||
|
||||
b = nm_setting_bridge_get_multicast_snooping (s_bridge);
|
||||
if (b != get_setting_default_boolean (NM_SETTING (s_bridge), NM_SETTING_BRIDGE_MULTICAST_SNOOPING)) {
|
||||
if (opts->len)
|
||||
g_string_append_c (opts, ' ');
|
||||
g_string_append_printf (opts, "multicast_snooping=%u", (guint32) b);
|
||||
}
|
||||
|
||||
if (opts->len)
|
||||
svSetValue (ifcfg, "BRIDGING_OPTS", opts->str, FALSE);
|
||||
g_string_free (opts, TRUE);
|
||||
|
|
@ -1428,11 +1453,11 @@ write_bridge_port_setting (NMConnection *connection, shvarFile *ifcfg, GError **
|
|||
opts = g_string_sized_new (32);
|
||||
|
||||
i = nm_setting_bridge_port_get_priority (s_port);
|
||||
if (i != get_setting_default (NM_SETTING (s_port), NM_SETTING_BRIDGE_PORT_PRIORITY))
|
||||
if (i != get_setting_default_uint (NM_SETTING (s_port), NM_SETTING_BRIDGE_PORT_PRIORITY))
|
||||
g_string_append_printf (opts, "priority=%u", i);
|
||||
|
||||
i = nm_setting_bridge_port_get_path_cost (s_port);
|
||||
if (i != get_setting_default (NM_SETTING (s_port), NM_SETTING_BRIDGE_PORT_PATH_COST)) {
|
||||
if (i != get_setting_default_uint (NM_SETTING (s_port), NM_SETTING_BRIDGE_PORT_PATH_COST)) {
|
||||
if (opts->len)
|
||||
g_string_append_c (opts, ' ');
|
||||
g_string_append_printf (opts, "path_cost=%u", i);
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ priority=32744
|
|||
hello-time=7
|
||||
max-age=39
|
||||
ageing-time=235352
|
||||
multicast-snooping=false
|
||||
|
||||
[ipv4]
|
||||
method=auto
|
||||
|
|
|
|||
|
|
@ -2811,6 +2811,7 @@ test_read_bridge_main (void)
|
|||
g_assert_cmpuint (nm_setting_bridge_get_hello_time (s_bridge), ==, 7);
|
||||
g_assert_cmpuint (nm_setting_bridge_get_max_age (s_bridge), ==, 39);
|
||||
g_assert_cmpuint (nm_setting_bridge_get_ageing_time (s_bridge), ==, 235352);
|
||||
g_assert_cmpuint (nm_setting_bridge_get_multicast_snooping (s_bridge), ==, FALSE);
|
||||
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue