From 5c30feeee5cfee74840444b63329fa5a13b471d2 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Thu, 10 Nov 2022 18:44:43 +0100 Subject: xt: Delay libxtables access until translation There is no point in spending efforts setting up the xt match/target when it is not printed afterwards. So just store the statement data from libnftnl in struct xt_stmt and perform the extension lookup from xt_stmt_xlate() instead. This means some data structures are only temporarily allocated for the sake of passing to libxtables callbacks, no need to drag them around. Also no need to clone the looked up extension, it is needed only to call the functions it provides. While being at it, select numeric output in xt_xlate_*_params - otherwise there will be reverse DNS lookups which should not happen by default. Signed-off-by: Phil Sutter --- include/statement.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'include/statement.h') diff --git a/include/statement.h b/include/statement.h index 2a2d3001..8651fc78 100644 --- a/include/statement.h +++ b/include/statement.h @@ -264,12 +264,11 @@ struct xtables_target; struct xt_stmt { const char *name; enum nft_xt_type type; + uint32_t rev; + uint32_t family; + size_t infolen; + void *info; uint32_t proto; - union { - struct xtables_match *match; - struct xtables_target *target; - }; - void *entry; }; extern struct stmt *xt_stmt_alloc(const struct location *loc); -- cgit v1.2.3