l3-config-data: fix comparing obj_b with itself in IPv4 address ID comparison

In _dedup_multi_index_cmp(), the !cmp_full path for NMP_OBJECT_TYPE_IP4_ADDRESS
compares obj_b->ip4_address.address with obj_b->ip4_address.address (and same
for peer_address), which always evaluates to zero. This means two different IPv4
addresses with the same plen are incorrectly considered equal.

Use obj_a on the left side of the comparison as intended.

Fixes: cb29244552 ('core: support compare flags in nm_l3_config_data_cmp_full()')
This commit is contained in:
Beniamino Galvani 2026-05-30 17:11:33 +02:00
parent 348af3aa30
commit 63173a4e33

View file

@ -2490,8 +2490,8 @@ _dedup_multi_index_cmp(const NML3ConfigData *a,
switch (obj_type) {
case NMP_OBJECT_TYPE_IP4_ADDRESS:
NM_CMP_DIRECT(obj_a->ip4_address.plen, obj_b->ip4_address.plen);
NM_CMP_DIRECT(obj_b->ip4_address.address, obj_b->ip4_address.address);
NM_CMP_DIRECT(obj_b->ip4_address.peer_address, obj_b->ip4_address.peer_address);
NM_CMP_DIRECT(obj_a->ip4_address.address, obj_b->ip4_address.address);
NM_CMP_DIRECT(obj_a->ip4_address.peer_address, obj_b->ip4_address.peer_address);
break;
case NMP_OBJECT_TYPE_IP6_ADDRESS:
NM_CMP_DIRECT(obj_a->ip6_address.plen, obj_b->ip6_address.plen);