diff options
author | Phil Sutter <phil@nwl.cc> | 2023-06-15 15:24:28 +0200 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2023-07-13 16:57:56 +0200 |
commit | 83e0f4402fb731633975b54ee043820d3cc7ed8e (patch) | |
tree | 36fa5f53e74d9e9c457305accd6196140709e4f1 /src/netlink.c | |
parent | e2431ab955fe453b5fd25a3ab3090fbf4bf3e653 (diff) |
Implement 'reset {set,map,element}' commands
All these are used to reset state in set/map elements, i.e. reset the
timeout or zero quota and counter values.
While 'reset element' expects a (list of) elements to be specified which
should be reset, 'reset set/map' will reset all elements in the given
set/map.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'src/netlink.c')
-rw-r--r-- | src/netlink.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/netlink.c b/src/netlink.c index 3352ad0a..ed61cd89 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -1515,7 +1515,7 @@ static int list_setelements(struct nftnl_set *s, struct netlink_ctx *ctx) } int netlink_list_setelems(struct netlink_ctx *ctx, const struct handle *h, - struct set *set) + struct set *set, bool reset) { struct nftnl_set *nls; int err; @@ -1530,7 +1530,7 @@ int netlink_list_setelems(struct netlink_ctx *ctx, const struct handle *h, if (h->handle.id) nftnl_set_set_u64(nls, NFTNL_SET_HANDLE, h->handle.id); - err = mnl_nft_setelem_get(ctx, nls); + err = mnl_nft_setelem_get(ctx, nls, reset); if (err < 0) { nftnl_set_free(nls); if (errno == EINTR) @@ -1558,7 +1558,7 @@ int netlink_list_setelems(struct netlink_ctx *ctx, const struct handle *h, int netlink_get_setelem(struct netlink_ctx *ctx, const struct handle *h, const struct location *loc, struct set *cache_set, - struct set *set, struct expr *init) + struct set *set, struct expr *init, bool reset) { struct nftnl_set *nls, *nls_out = NULL; int err = 0; @@ -1577,7 +1577,7 @@ int netlink_get_setelem(struct netlink_ctx *ctx, const struct handle *h, netlink_dump_set(nls, ctx); - nls_out = mnl_nft_setelem_get_one(ctx, nls); + nls_out = mnl_nft_setelem_get_one(ctx, nls, reset); if (!nls_out) { nftnl_set_free(nls); return -1; |