cache: filter out rules by chain
Pablo Neira Ayuso
maintainerPATCH 1/1 cache: filter out rules by chain
With an autogenerated ruleset with ~20k chains.
# time nft list ruleset &> /dev/null
real 0m1,712s user 0m1,258s sys 0m0,454s
Speed up listing of a specific chain:
# time nft list chain nat MWDG-UGR-234PNG3YBUOTS5QD &> /dev/null
real 0m0,542s user 0m0,251s sys 0m0,292s
Signed-off-by Pablo Neira Ayuso <[email protected]>
--- include/cache.h | 1 + include/netlink.h | 2 -- src/cache.c | 84 +++++++++++++++++++++++++++++++++++++++++++++-- src/netlink.c | 42 ------------------------ 4 files changed, 82 insertions(+), 47 deletions(-)
include/cache.h +1 -0
@@ -51,6 +51,7 @@ struct nft_cache_filter {struct {uint32_t family;const char *table; +const char *chain;const char *set; } list;
include/netlink.h +0 -2
@@ -124,8 +124,6 @@ extern struct expr *netlink_alloc_data(const struct location *loc,const struct nft_data_delinearize *nld, enum nft_registers dreg); -extern int netlink_list_rules (struct netlink_ctx *ctx,const struct handle *h); -struct netlink_linearize_ctx ; extern void netlink_linearize_rule(struct netlink_ctx *ctx, const struct rule *rule,
src/cache.c +81 -3
135 lines not on this page · raw message
src/netlink.c +0 -42
48 lines not on this page · raw message
Signature · 1 line
2.30.2