summaryrefslogtreecommitdiffstats
path: root/src/netlink.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2018-04-24 01:21:32 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2018-04-24 01:30:09 +0200
commit760bd16776b111c006ba209545abfc5c849702b4 (patch)
tree0ed306e0dffb8bc062d6454b3cf87ee0bfa66a9e /src/netlink.c
parent35ba5cfa4c092db6c7889756083169f2b259238e (diff)
src: simplify netlink_get_setelems() and rename it to netlink_list_setelems()
This is called from cache population path, remove netlink_io_error() call since this is not needed. Rename it for consistency with similar netlink_list_*() NLM_F_DUMP functions. Get rid of location parameter. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/netlink.c')
-rw-r--r--src/netlink.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/netlink.c b/src/netlink.c
index 9e11af5d..372caaa9 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -1294,8 +1294,8 @@ static int list_setelem_cb(struct nftnl_set_elem *nlse, void *arg)
return netlink_delinearize_setelem(nlse, ctx->set, ctx->cache);
}
-int netlink_get_setelems(struct netlink_ctx *ctx, const struct handle *h,
- const struct location *loc, struct set *set)
+int netlink_list_setelems(struct netlink_ctx *ctx, const struct handle *h,
+ struct set *set)
{
struct nftnl_set *nls;
int err;
@@ -1308,11 +1308,11 @@ int netlink_get_setelems(struct netlink_ctx *ctx, const struct handle *h,
if (errno == EINTR)
return -1;
- goto out;
+ return 0;
}
ctx->set = set;
- set->init = set_expr_alloc(loc, set);
+ set->init = set_expr_alloc(&internal_location, set);
nftnl_set_elem_foreach(nls, list_setelem_cb, ctx);
if (!(set->flags & NFT_SET_INTERVAL))
@@ -1323,11 +1323,8 @@ int netlink_get_setelems(struct netlink_ctx *ctx, const struct handle *h,
if (set->flags & NFT_SET_INTERVAL)
interval_map_decompose(set->init);
-out:
- if (err < 0)
- netlink_io_error(ctx, loc, "Could not receive set elements: %s",
- strerror(errno));
- return err;
+
+ return 0;
}
int netlink_get_setelem(struct netlink_ctx *ctx, const struct handle *h,