From 9edaa6a51eab49a378dd358e0b4254d0398c629f Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Tue, 20 Jul 2021 12:17:33 +0200 Subject: src: add --define key=value This patch adds a new option to define variables from the command line. # cat test.nft table netdev x { chain y { type filter hook ingress devices = $dev priority 0; counter accept } } # nft --define dev="{ eth0, eth1 }" -f test.nft You can only combine it with -f/--filename. Signed-off-by: Pablo Neira Ayuso --- include/nftables.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include/nftables.h') diff --git a/include/nftables.h b/include/nftables.h index f239fcf0..7b633905 100644 --- a/include/nftables.h +++ b/include/nftables.h @@ -100,12 +100,23 @@ struct mnl_socket; struct parser_state; struct scope; +struct nft_vars { + const char *key; + const char *value; +}; + #define MAX_INCLUDE_DEPTH 16 struct nft_ctx { struct mnl_socket *nf_sock; char **include_paths; unsigned int num_include_paths; + struct nft_vars *vars; + struct { + const char *buf; + struct list_head indesc_list; + } vars_ctx; + unsigned int num_vars; unsigned int parser_max_errors; unsigned int debug_mask; struct output_ctx output; -- cgit v1.2.3