l3cfg: add nm_l3_config_data_lookup_address_6() helper

This commit is contained in:
Thomas Haller 2020-09-16 14:05:54 +02:00
parent 62f2c5a879
commit dbfb7fe2d7
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
2 changed files with 25 additions and 0 deletions

View file

@ -623,6 +623,28 @@ nm_l3_config_data_lookup_obj (const NML3ConfigData *self,
obj);
}
const NMPlatformIP6Address *
nm_l3_config_data_lookup_address_6 (const NML3ConfigData *self,
const struct in6_addr *addr)
{
const NMDedupMultiEntry *head;
NMPObject obj_stack;
nm_assert (_NM_IS_L3_CONFIG_DATA (self, TRUE));
/* this works only, because the primary key for a Ipv6 address is the
* ifindex and the "struct in6_addr". */
nmp_object_stackinit_id_ip6_address (&obj_stack,
self->ifindex,
addr);
head = nm_l3_config_data_lookup_obj (self, &obj_stack);
if (!head)
return NULL;
return NMP_OBJECT_CAST_IP6_ADDRESS (head->obj);
}
const NMPObject *
nmtst_l3_config_data_get_obj_at (const NML3ConfigData *self,
NMPObjectType obj_type,

View file

@ -188,6 +188,9 @@ const NMDedupMultiIdxType *nm_l3_config_data_lookup_index (const NML3ConfigData
const NMDedupMultiEntry *nm_l3_config_data_lookup_obj (const NML3ConfigData *self,
const NMPObject *obj);
const NMPlatformIP6Address *nm_l3_config_data_lookup_address_6 (const NML3ConfigData *self,
const struct in6_addr *addr);
const NMDedupMultiEntry *nm_l3_config_data_lookup_route_obj (const NML3ConfigData *self,
const NMPObject *needle);