]> git.ipfire.org Git - thirdparty/nftables.git/commit
json: allow to specify comment on table
authorPablo Neira Ayuso <pablo@netfilter.org>
Mon, 24 Apr 2023 21:17:50 +0000 (23:17 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 22 Jan 2025 23:05:48 +0000 (00:05 +0100)
commitf95039826a1e439c4f3c6efffdf0c2b7958191c9
tree99fa31ea4ff74d9c34285126d1d9d068646bad69
parentfd1b8d5bd4e23361219525fc73a717f931500541
json: allow to specify comment on table

commit fd595286a68e2c676657d4ac753da517a4d0c3a2 upstream.

Allow users to add a comment when declaring a table:

 # sudo nft add table inet test3 '{comment "this is a comment";}'
 # nft list ruleset
 table inet test3 {
        comment "this is a comment"
 }
 # nft -j list ruleset
 {"nftables": [{"metainfo": {"version": "1.0.7", "release_name": "Old Doc Yak", "json_schema_version": 1}}, {"table": {"family": "inet", "name": "test3", "handle": 3, "comment": "this is a comment"}}]}
 # nft -j list ruleset > test.json
 # nft flush ruleset
 # nft -j -f test.json
 # nft -j list ruleset
 {"nftables": [{"metainfo": {"version": "1.0.7", "release_name": "Old Doc Yak", "json_schema_version": 1}}, {"table": {"family": "inet", "name": "test3", "handle": 4, "comment": "this is a comment"}}]}

Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1670
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/json.c
src/parser_json.c