[Bug 1319] New: Exporting a map with many elements to JSON will fail

bugzilla-daemon at netfilter.org bugzilla-daemon at netfilter.org
Thu Jan 24 06:12:36 CET 2019


https://bugzilla.netfilter.org/show_bug.cgi?id=1319

            Bug ID: 1319
           Summary: Exporting a map with many elements to JSON will fail
           Product: nftables
           Version: unspecified
          Hardware: x86_64
                OS: RedHat Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: nft
          Assignee: pablo at netfilter.org
          Reporter: mizuno at axsh.net

When exporting a map with many(more than 32?) elements to JSON, broken JSON
will be output.

----
#!/bin/bash

nft "add table ip ttt"
nft "add map ip ttt my_map { type ipv4_addr : ipv4_addr ; }"
for i in $(seq 1 33); do
  nft "add element ip ttt my_map { 203.0.113.${i} : 192.0.2.1 }"
done

nft export json | jq .nftables
----

The above script throws the following error:

  parse error: Unmatched ']' at line 1, column 4257

This error can be avoided by rewriting the last line as follows:

  nft export json | sed 's/]}$/}]}/' | jq .nftables

It seems to be caused by missing closing } of the "set" object.

----
% nft --version
nftables v0.8 (Joe Btfsplk)

% uname -a
Linux devops 3.10.0-957.1.3.el7.x86_64 #1 SMP Thu Nov 29 14:49:43 UTC 2018
x86_64 x86_64 x86_64 GNU/Linux
----

Thanks.

-- 
You are receiving this mail because:
You are watching all bug changes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.netfilter.org/pipermail/netfilter-buglog/attachments/20190124/e82a03cf/attachment.html>


More information about the netfilter-buglog mailing list