]> git.ipfire.org Git - thirdparty/nftables.git/commit
libnftables: Store top_scope in struct nft_ctx
authorPhil Sutter <phil@nwl.cc>
Wed, 30 Oct 2019 20:45:39 +0000 (21:45 +0100)
committerPhil Sutter <phil@nwl.cc>
Thu, 7 Nov 2019 11:46:16 +0000 (12:46 +0100)
commit332325e3c3fab4c25bb5f387f9663205f63748dc
treeb9e616a69a3b87829c4f6531a6677119d9af6275
parent856c78d4fdc73ac746ef1473f08d78cf2ebcbc4c
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 <phil@nwl.cc>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/nftables.h
include/parser.h
include/rule.h
src/libnftables.c
src/parser_bison.y
src/rule.c
tests/shell/testcases/nft-i/0001define_0 [new file with mode: 0755]