lldp: fix lldp_neighbor_equal() to compare lists of variants

Fixes: 6c52d946fc ('lldp: add support for management address TLV')
(cherry picked from commit 7c0d73d94a)
(cherry picked from commit 0426681ab4)
(cherry picked from commit 321f9b51c3)
(cherry picked from commit 2e9d7c84d6)
This commit is contained in:
Thomas Haller 2020-06-05 19:55:21 +02:00
parent 2dd77af678
commit ecfc48eca5
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -400,6 +400,19 @@ lldp_neighbor_equal (LldpNeighbor *a, LldpNeighbor *b)
if (!nm_streq (a->attrs[attr_id].v_string, b->attrs[attr_id].v_string))
return FALSE;
break;
case LLDP_ATTR_TYPE_ARRAY_OF_VARDICTS: {
NMCListElem *itr_a, *itr_b;
if (c_list_length (&a->attrs[attr_id].v_variant_list) != c_list_length (&b->attrs[attr_id].v_variant_list))
return FALSE;
itr_b = c_list_first_entry (&b->attrs[attr_id].v_variant_list, NMCListElem, lst);
c_list_for_each_entry (itr_a, &a->attrs[attr_id].v_variant_list, lst) {
if (!g_variant_equal (itr_a->data, itr_b->data))
return FALSE;
itr_b = c_list_entry (&itr_b->lst, NMCListElem, lst);
}
break;
}
default:
nm_assert (a->attrs[attr_id].attr_type == LLDP_ATTR_TYPE_NONE);
break;