summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-09-16 14:05:54 +0200
committerThomas Haller <thaller@redhat.com>2020-09-24 09:43:54 +0200
commitdbfb7fe2d79c9421518c5350a0c3a1cb42b51110 (patch)
tree9cda01cdb6b0d410ef20eb5bd65550a3e9e89a28
parent62f2c5a879c70c5a9f28de9007c49aa5eeb24670 (diff)
downloadNetworkManager-dbfb7fe2d79c9421518c5350a0c3a1cb42b51110.tar.gz
l3cfg: add nm_l3_config_data_lookup_address_6() helper
-rw-r--r--src/nm-l3-config-data.c22
-rw-r--r--src/nm-l3-config-data.h3
2 files changed, 25 insertions, 0 deletions
diff --git a/src/nm-l3-config-data.c b/src/nm-l3-config-data.c
index a5080b0bb8..91cb7190eb 100644
--- a/src/nm-l3-config-data.c
+++ b/src/nm-l3-config-data.c
@@ -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,
diff --git a/src/nm-l3-config-data.h b/src/nm-l3-config-data.h
index fe7bac03be..1f3a33eaac 100644
--- a/src/nm-l3-config-data.h
+++ b/src/nm-l3-config-data.h
@@ -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);