core: fix adding objects to NMIPConfig with @append_force

If the @append_force argument is set and the object is already in the
list, it must be moved at the end.

Fixes: 22edeb5b69 ('core: track addresses for NMIP4Config/NMIP6Config via NMDedupMultiIndex')
(cherry picked from commit 8b121c7048)
This commit is contained in:
Beniamino Galvani 2019-08-27 18:27:24 +02:00
parent ebaf890057
commit 52241748e8
2 changed files with 4 additions and 4 deletions

View file

@ -190,7 +190,9 @@ _nm_ip_config_add_obj (NMDedupMultiIndex *multi_idx,
if (!nm_dedup_multi_index_add_full (multi_idx,
&idx_type->parent,
obj_new,
NM_DEDUP_MULTI_IDX_MODE_APPEND,
append_force
? NM_DEDUP_MULTI_IDX_MODE_APPEND_FORCE
: NM_DEDUP_MULTI_IDX_MODE_APPEND,
NULL,
entry_old ?: NM_DEDUP_MULTI_ENTRY_MISSING,
NULL,

View file

@ -112,9 +112,7 @@ test_replace (void)
g_assert (nm_ip4_config_replace (config2, config1, &relevant_changes));
g_assert (relevant_changes);
/* FIXME: this currently fails due to a bug in replace() */
g_assert (!nm_ip4_config_equal (config1, config2));
g_assert (nm_ip4_config_equal (config1, config2));
}
static void