diff options
author | Phil Sutter <phil@nwl.cc> | 2021-11-29 16:26:44 +0100 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2021-12-03 12:50:18 +0100 |
commit | 17297d1acbbff0133f8614dbee6717edf55c39f8 (patch) | |
tree | d3d0f078888445061be8af50cdf4045b6e62f982 /include | |
parent | 95781fcbddcd6524f67a3357c0cf91f13be24053 (diff) |
cache: Filter chain list on kernel side
When operating on a specific chain, add payload to NFT_MSG_GETCHAIN so
kernel returns only relevant data. Since ENOENT is an expected return
code, do not treat this as error.
While being at it, improve code in chain_cache_cb() a bit:
- Check chain's family first, it is a less expensive check than
comparing table names.
- Do not extract chain name of uninteresting chains.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'include')
-rw-r--r-- | include/mnl.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/mnl.h b/include/mnl.h index 19faa651..9d54aac8 100644 --- a/include/mnl.h +++ b/include/mnl.h @@ -43,7 +43,8 @@ int mnl_nft_chain_rename(struct netlink_ctx *ctx, const struct cmd *cmd, const struct chain *chain); struct nftnl_chain_list *mnl_nft_chain_dump(struct netlink_ctx *ctx, - int family); + int family, const char *table, + const char *chain); int mnl_nft_table_add(struct netlink_ctx *ctx, struct cmd *cmd, unsigned int flags); |