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.
This commit is contained in:
Thomas Haller
2020-10-21 12:15:06 +02:00
parent b38fbb3bf6
commit 15f5d10352
2 changed files with 15 additions and 0 deletions

View File

@@ -125,6 +125,19 @@ _l3cfg_weak_notify(gpointer data, GObject *where_the_object_was)
g_object_unref(self);
}
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)
{

View File

@@ -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);
/*****************************************************************************/