diff options
author | Phil Sutter <phil@nwl.cc> | 2021-11-29 15:28:33 +0100 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2021-12-03 12:50:18 +0100 |
commit | a37212f2fd90739e17f3dbb96ea6284d7755bf5f (patch) | |
tree | c508b297db88ff2e2ff0e76f408173c0b33041d6 /src/cache.c | |
parent | 49ac868a0d5b99bad5dbf5603ebf02237a37459d (diff) |
cache: Filter tables on kernel side
Instead of requesting a dump of all tables and filtering the data in
user space, construct a non-dump request if filter contains a table so
kernel returns only that single table.
This should improve nft performance in rulesets with many tables
present.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'src/cache.c')
-rw-r--r-- | src/cache.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/src/cache.c b/src/cache.c index 6d20716d..66da2b34 100644 --- a/src/cache.c +++ b/src/cache.c @@ -772,19 +772,12 @@ static int cache_init_tables(struct netlink_ctx *ctx, struct handle *h, struct table *table, *next; int ret; - ret = netlink_list_tables(ctx, h); + ret = netlink_list_tables(ctx, h, filter); if (ret < 0) return -1; list_for_each_entry_safe(table, next, &ctx->list, list) { list_del(&table->list); - - if (filter && filter->list.table && - (filter->list.family != table->handle.family || - strcmp(filter->list.table, table->handle.table.name))) { - table_free(table); - continue; - } table_cache_add(table, cache); } |