summaryrefslogtreecommitdiff
path: root/src/nl-addr-list.c
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2012-11-16 01:11:55 +0100
committerThomas Graf <tgraf@suug.ch>2012-11-16 01:11:55 +0100
commit00132b46968fff7975eb8d20a307c626dfefe2f1 (patch)
treee2d6ea3d7535358435ea136019e03c35c22c19ba /src/nl-addr-list.c
parent23c4ef67c735813fd41f66f6722b996d1ad7314a (diff)
downloadlibnl-00132b46968fff7975eb8d20a307c626dfefe2f1.tar.gz
cache: provide safe variant of nl_cache_mngt_require() and use it
This makes runtime removal of cache operations possible if non-safe API is not in use by application. The non-safe API will be removed in the next major version. Signed-off-by: Thomas Graf <tgraf@suug.ch>
Diffstat (limited to 'src/nl-addr-list.c')
-rw-r--r--src/nl-addr-list.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nl-addr-list.c b/src/nl-addr-list.c
index 5044d5c..20995a8 100644
--- a/src/nl-addr-list.c
+++ b/src/nl-addr-list.c
@@ -65,7 +65,7 @@ static void env_dump(struct nl_object *obj, void *arg)
nl_addr2str(rtnl_addr_get_local(addr), buf, sizeof(buf)));
nl_dump_line(p, "%s_IFINDEX=%u\n", pfx, rtnl_addr_get_ifindex(addr));
- link_cache = nl_cache_mngt_require("route/link");
+ link_cache = nl_cache_mngt_require_safe("route/link");
if (link_cache)
nl_dump_line(p, "%s_IFNAME=%s\n", pfx,
rtnl_link_i2name(link_cache,
@@ -94,6 +94,9 @@ static void env_dump(struct nl_object *obj, void *arg)
nl_dump_line(p, "%s_CACHEINFO_VALID=%u\n", pfx,
rtnl_addr_get_valid_lifetime(addr));
+ if (link_cache)
+ nl_cache_put(link_cache);
+
#if 0
if (addr->ce_mask & ADDR_ATTR_CACHEINFO) {
struct rtnl_addr_cacheinfo *ci = &addr->a_cacheinfo;