connection: treat connection type's ability to have slaves uniformly

This also adds OVS_BRIDGE and OVS_PORT to places that didn't consider
them to be master types
This commit is contained in:
Lubomir Rintel
2018-01-18 10:43:48 +01:00
parent 1440fe6a88
commit d50e8d3ec1
3 changed files with 15 additions and 7 deletions

View File

@@ -496,4 +496,17 @@ gboolean _nm_utils_string_append_tc_tfilter_rest (GString *string,
/*****************************************************************************/
static inline gboolean
_nm_connection_type_is_master (const char *type)
{
return (NM_IN_STRSET (type,
NM_SETTING_BOND_SETTING_NAME,
NM_SETTING_BRIDGE_SETTING_NAME,
NM_SETTING_TEAM_SETTING_NAME,
NM_SETTING_OVS_BRIDGE_SETTING_NAME,
NM_SETTING_OVS_PORT_SETTING_NAME));
}
/*****************************************************************************/
#endif

View File

@@ -391,10 +391,7 @@ _set_applied_connection_take (NMActiveConnection *self,
if (nm_setting_connection_get_master (s_con))
flags_val |= NM_ACTIVATION_STATE_FLAG_IS_SLAVE;
if (NM_IN_STRSET (nm_setting_connection_get_connection_type (s_con),
NM_SETTING_BOND_SETTING_NAME,
NM_SETTING_BRIDGE_SETTING_NAME,
NM_SETTING_TEAM_SETTING_NAME))
if (+_nm_connection_type_is_master (nm_setting_connection_get_connection_type (s_con)))
flags_val |= NM_ACTIVATION_STATE_FLAG_IS_MASTER;
nm_active_connection_set_state_flags_full (self,

View File

@@ -1757,9 +1757,7 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg)
/* Only save the value for master connections */
type = nm_setting_connection_get_connection_type (s_con);
if ( !g_strcmp0 (type, NM_SETTING_BOND_SETTING_NAME)
|| !g_strcmp0 (type, NM_SETTING_TEAM_SETTING_NAME)
|| !g_strcmp0 (type, NM_SETTING_BRIDGE_SETTING_NAME)) {
if (_nm_connection_type_is_master (type)) {
NMSettingConnectionAutoconnectSlaves autoconnect_slaves;
autoconnect_slaves = nm_setting_connection_get_autoconnect_slaves (s_con);
svSetValueStr (ifcfg, "AUTOCONNECT_SLAVES",