From 17297d1acbbff0133f8614dbee6717edf55c39f8 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Mon, 29 Nov 2021 16:26:44 +0100 Subject: 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 --- include/mnl.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') 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); -- cgit v1.2.3