FS#60694 - [nftables] Add json(/xml) support via libjansson
Attached to Project:
Arch Linux
Opened by Markus R. (mqus) - Sunday, 04 November 2018, 01:47 GMT
Last edited by Sébastien Luttringer (seblu) - Thursday, 06 December 2018, 03:30 GMT
Opened by Markus R. (mqus) - Sunday, 04 November 2018, 01:47 GMT
Last edited by Sébastien Luttringer (seblu) - Thursday, 06 December 2018, 03:30 GMT
|
Details
Description:
In the wiki and manpage there are some parts which explain support/output with json/xml. When I tried the commands, they didn't work (Examples below). So I started to look and found out that nft actually somehow depends (optionally) on libjansson (See https://git.netfilter.org/nftables/tree/configure.ac#n92 and https://git.netfilter.org/nftables/tree/include/json.h#n23 ). This is sadly not mentioned neither in the INSTALL file, nor on the netfilter.org page nor in the wiki. Could we please add json[1] support? It would be perfect if this could be an optional dependency but I don't know if this would be possible here. [1] Maybe also xml support but I wouldn't use it and have no idea how complicated that would be. Additional info: * package version(s): v0.9.0 * config and/or log files etc. Steps to reproduce: ``` $ sudo nft export ruleset json Error: this output type is not supported export ruleset json ^^^^^^^^^^^^^^^^^^^^ ``` Or also (--help explains that -j enables json output): ``` $ sudo nft list ruleset -j table inet filter { chain input { type filter hook input priority 0; policy accept; ct state { established, related } accept ct state invalid drop iifname "lo" accept ip protocol icmp accept ip6 nexthdr ipv6-icmp accept reject } chain forward { type filter hook forward priority 0; policy accept; drop } chain output { type filter hook output priority 0; policy accept; } } ``` (this is obviously not json but the default output) |
This task depends upon
Closed by Sébastien Luttringer (seblu)
Thursday, 06 December 2018, 03:30 GMT
Reason for closing: Implemented
Additional comments about closing: nftables-1:0.9.0-2
Thursday, 06 December 2018, 03:30 GMT
Reason for closing: Implemented
Additional comments about closing: nftables-1:0.9.0-2
But, looking at jansson deps, I found several which are already in extra, like ctags, libnm, smbclient, etc.
So, maybe the rule changed and I missed it. So, I will add the link to jansson to get json output.