diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2018-01-18 10:43:48 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2018-01-18 11:11:39 +0100 |
commit | 33dfb54434108c67f3659a73a30c586729ed8be4 (patch) | |
tree | 15da8a7e586582b7e9202f6fd3ac7b1c68831be3 | |
parent | b57687841827d27d776567bc9aca8a4785c60707 (diff) | |
download | NetworkManager-lr/ovs-eth.tar.gz |
connection: treat connection type's ability to have slaves uniformlylr/ovs-eth
This also adds OVS_BRIDGE and OVS_PORT to places that didn't consider
them to be master types
-rw-r--r-- | libnm-core/nm-core-internal.h | 13 | ||||
-rw-r--r-- | src/nm-active-connection.c | 5 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c | 4 |
3 files changed, 15 insertions, 7 deletions
diff --git a/libnm-core/nm-core-internal.h b/libnm-core/nm-core-internal.h index 77c7fe2900..7260ebfdb2 100644 --- a/libnm-core/nm-core-internal.h +++ b/libnm-core/nm-core-internal.h @@ -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 diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c index 2286a74b4f..29f043188f 100644 --- a/src/nm-active-connection.c +++ b/src/nm-active-connection.c @@ -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, 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 a775f1e05f..33f7833957 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c @@ -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", |