summaryrefslogtreecommitdiffstats
path: root/lib/netfilter
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2012-11-16 00:11:55 (GMT)
committerThomas Graf <tgraf@suug.ch>2012-11-16 00:11:55 (GMT)
commit00132b46968fff7975eb8d20a307c626dfefe2f1 (patch)
treee2d6ea3d7535358435ea136019e03c35c22c19ba /lib/netfilter
parent23c4ef67c735813fd41f66f6722b996d1ad7314a (diff)
downloadlibnl-00132b46968fff7975eb8d20a307c626dfefe2f1.zip
libnl-00132b46968fff7975eb8d20a307c626dfefe2f1.tar.gz
libnl-00132b46968fff7975eb8d20a307c626dfefe2f1.tar.bz2
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 'lib/netfilter')
-rw-r--r--lib/netfilter/log_msg_obj.c5
-rw-r--r--lib/netfilter/queue_msg_obj.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/netfilter/log_msg_obj.c b/lib/netfilter/log_msg_obj.c
index d2cde4e..d2ad0ff 100644
--- a/lib/netfilter/log_msg_obj.c
+++ b/lib/netfilter/log_msg_obj.c
@@ -76,7 +76,7 @@ static void log_msg_dump(struct nl_object *a, struct nl_dump_params *p)
struct nl_cache *link_cache;
char buf[64];
- link_cache = nl_cache_mngt_require("route/link");
+ link_cache = nl_cache_mngt_require_safe("route/link");
nl_new_line(p);
@@ -167,6 +167,9 @@ static void log_msg_dump(struct nl_object *a, struct nl_dump_params *p)
nl_dump(p, "SEQGLOBAL=%d ", msg->log_msg_seq_global);
nl_dump(p, "\n");
+
+ if (link_cache)
+ nl_cache_put(link_cache);
}
/**
diff --git a/lib/netfilter/queue_msg_obj.c b/lib/netfilter/queue_msg_obj.c
index 33305ed..bfaafc5 100644
--- a/lib/netfilter/queue_msg_obj.c
+++ b/lib/netfilter/queue_msg_obj.c
@@ -66,7 +66,7 @@ static void nfnl_queue_msg_dump(struct nl_object *a, struct nl_dump_params *p)
struct nl_cache *link_cache;
char buf[64];
- link_cache = nl_cache_mngt_require("route/link");
+ link_cache = nl_cache_mngt_require_safe("route/link");
nl_new_line(p);
@@ -152,6 +152,9 @@ static void nfnl_queue_msg_dump(struct nl_object *a, struct nl_dump_params *p)
buf, sizeof(buf)));
nl_dump(p, "\n");
+
+ if (link_cache)
+ nl_cache_put(link_cache);
}
/**