summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-10-21 12:15:06 +0200
committerThomas Haller <thaller@redhat.com>2020-10-23 17:11:54 +0200
commit15f5d10352544b628164f38f207e29236b0ff9e5 (patch)
tree442f984b8c8b8368c6581c037a31ea9fa55fda40
parentb38fbb3bf621a45c8a00beb290ae0c29fb226ba3 (diff)
l3cfg: add nm_netns_get_l3cfg() accessor
This is more for debugging and testing. Usually you want to call nm_netns_access_l3cfg() which creates a NML3Cfg instance, if necessary.
-rw-r--r--src/nm-netns.c13
-rw-r--r--src/nm-netns.h2
2 files changed, 15 insertions, 0 deletions
diff --git a/src/nm-netns.c b/src/nm-netns.c
index 2970e45c9..c5a445ac6 100644
--- a/src/nm-netns.c
+++ b/src/nm-netns.c
@@ -126,6 +126,19 @@ _l3cfg_weak_notify(gpointer data, GObject *where_the_object_was)
}
NML3Cfg *
+nm_netns_get_l3cfg(NMNetns *self, int ifindex)
+{
+ NMNetnsPrivate *priv;
+
+ g_return_val_if_fail(NM_IS_NETNS(self), NULL);
+ g_return_val_if_fail(ifindex > 0, NULL);
+
+ priv = NM_NETNS_GET_PRIVATE(self);
+
+ return g_hash_table_lookup(priv->l3cfgs, &ifindex);
+}
+
+NML3Cfg *
nm_netns_access_l3cfg(NMNetns *self, int ifindex)
{
NMNetnsPrivate *priv;
diff --git a/src/nm-netns.h b/src/nm-netns.h
index bb0c955ef..5ae0c294b 100644
--- a/src/nm-netns.h
+++ b/src/nm-netns.h
@@ -31,6 +31,8 @@ struct _NMDedupMultiIndex *nm_netns_get_multi_idx(NMNetns *self);
#define NM_NETNS_GET (nm_netns_get())
+NML3Cfg *nm_netns_get_l3cfg(NMNetns *self, int ifindex);
+
NML3Cfg *nm_netns_access_l3cfg(NMNetns *netns, int ifindex);
/*****************************************************************************/