summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-03-21 11:08:12 +0100
committerThomas Haller <thaller@redhat.com>2019-03-24 09:21:14 +0100
commit5478853a0b25fa33df10ca254b99c7cb493745d3 (patch)
tree013fe45a3efa1350fad47e0e7d560105cee8935a
parent9d2a15514aef28fe57331b98dc6ce109da17978b (diff)
downloadNetworkManager-5478853a0b25fa33df10ca254b99c7cb493745d3.tar.gz
libnm/team: check for changes to team:runner-tx-hash in _align_team_properties()
We will need to emit property changed signals. For that we need to know whether the property changes. Compare it.
-rw-r--r--libnm-core/nm-setting-team.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/libnm-core/nm-setting-team.c b/libnm-core/nm-setting-team.c
index f50747f179..22cd3f737c 100644
--- a/libnm-core/nm-setting-team.c
+++ b/libnm-core/nm-setting-team.c
@@ -1365,7 +1365,7 @@ _align_team_properties (NMSettingTeam *setting)
{
NMSettingTeamPrivate *priv = NM_SETTING_TEAM_GET_PRIVATE (setting);
char **strv;
- int i;
+ gsize i;
priv->notify_peers_count = JSON_TO_VAL (int, PROP_NOTIFY_PEERS_COUNT);
priv->notify_peers_interval = JSON_TO_VAL (int, PROP_NOTIFY_PEERS_INTERVAL);
@@ -1387,14 +1387,24 @@ _align_team_properties (NMSettingTeam *setting)
priv->runner_tx_balancer = JSON_TO_VAL (string, PROP_RUNNER_TX_BALANCER);
priv->runner_agg_select_policy = JSON_TO_VAL (string, PROP_RUNNER_AGG_SELECT_POLICY);
- nm_clear_pointer (&priv->runner_tx_hash, g_ptr_array_unref);
-
strv = JSON_TO_VAL (strv, PROP_RUNNER_TX_HASH);
- if (strv) {
- for (i = 0; strv[i]; i++)
- nm_setting_team_add_runner_tx_hash (setting, strv[i]);
- g_strfreev (strv);
+ if (_nm_utils_strv_cmp_n (( priv->runner_tx_hash
+ ? (const char *const*) priv->runner_tx_hash->pdata
+ : NULL),
+ ( priv->runner_tx_hash
+ ? (gssize) priv->runner_tx_hash->len
+ : (gssize) -1),
+ NM_CAST_STRV_CC (strv),
+ -1) != 0) {
+ nm_clear_pointer (&priv->runner_tx_hash, g_ptr_array_unref);
+ if (strv && strv[0]) {
+ priv->runner_tx_hash = g_ptr_array_new_full (NM_PTRARRAY_LEN (strv), g_free);
+ for (i = 0; strv[i]; i++)
+ g_ptr_array_add (priv->runner_tx_hash, strv[i]);
+ nm_clear_g_free (&strv);
+ }
}
+ nm_clear_pointer (&strv, g_strfreev);
g_ptr_array_unref (priv->link_watchers);
priv->link_watchers = JSON_TO_VAL (ptr_array, PROP_LINK_WATCHERS);