From 332325e3c3fab4c25bb5f387f9663205f63748dc Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Wed, 30 Oct 2019 21:45:39 +0100 Subject: libnftables: Store top_scope in struct nft_ctx Allow for interactive sessions to make use of defines. Since parser is initialized for each line, top scope defines didn't persist although they are actually useful for stuff like: | # nft -i | define goodports = { 22, 23, 80, 443 } | add rule inet t c tcp dport $goodports accept | add rule inet t c tcp sport $goodports accept While being at it, introduce scope_alloc() and scope_free(). Signed-off-by: Phil Sutter Acked-by: Pablo Neira Ayuso --- tests/shell/testcases/nft-i/0001define_0 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 tests/shell/testcases/nft-i/0001define_0 (limited to 'tests') diff --git a/tests/shell/testcases/nft-i/0001define_0 b/tests/shell/testcases/nft-i/0001define_0 new file mode 100755 index 00000000..62e1b6de --- /dev/null +++ b/tests/shell/testcases/nft-i/0001define_0 @@ -0,0 +1,22 @@ +#!/bin/bash + +set -e + +# test if using defines in interactive nft sessions works + +$NFT -i >/dev/null </dev/null <