<html>
<head>
<base href="https://bugzilla.netfilter.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Exporting a map with many elements to JSON will fail"
href="https://bugzilla.netfilter.org/show_bug.cgi?id=1319">1319</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Exporting a map with many elements to JSON will fail
</td>
</tr>
<tr>
<th>Product</th>
<td>nftables
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>x86_64
</td>
</tr>
<tr>
<th>OS</th>
<td>RedHat Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P5
</td>
</tr>
<tr>
<th>Component</th>
<td>nft
</td>
</tr>
<tr>
<th>Assignee</th>
<td>pablo@netfilter.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>mizuno@axsh.net
</td>
</tr></table>
<p>
<div>
<pre>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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are watching all bug changes.</li>
</ul>
</body>
</html>