<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Subject: python3-nftables: nftables.Nftables class instance repeatedly returns -1 after single error occurs<br>
<div>Package: python3-nftables</div>
<div>Version: 0.9.3-2</div>
<div>Severity: normal</div>
<div><br>
</div>
<div>Dear Maintainer,</div>
<div><br>
</div>
<div>I am using the python wrapper in a program and faced a problem.</div>
<div>Trying to list a Table while the Ruleset is empty returns an error, no problem yet.</div>
<div>Every subsequent call to json_cmd() on the same nftables.Nftables class instance returns -1 in return code.</div>
<div><br>
</div>
<div>Here is a short script reproducing the error :</div>
<div><br>
</div>
<div>###### testNFTABLES.py ++</div>
<div><br>
</div>
<div>import nftables</div>
<div>import json</div>
<div><br>
</div>
<div>nft = nftables.Nftables()</div>
<div>nft.set_json_output(True)</div>
<div><br>
</div>
<div>flushRulesetCMD = '{ "nftables": [ { "flush": { "ruleset": null }} ]}'</div>
<div>getTableCMD = '{ "nftables": [ { "list": { "table": { "family": "inet", "name": "FooTable" }}} ]}'</div>
<div>addTableCMD = '{ "nftables": [ { "add": { "table": { "family": "inet", "name": "FooTable" }}} ]}'</div>
<div><br>
</div>
<div>result = nft.json_cmd(json.loads(flushRulesetCMD))</div>
<div>print(result)</div>
<div><br>
</div>
<div>result = nft.json_cmd(json.loads(getTableCMD))</div>
<div>print(result)</div>
<div><br>
</div>
<div># Resetting Nftables class instance makes it work</div>
<div># nft = nftables.Nftables()</div>
<div><br>
</div>
<div>result = nft.json_cmd(json.loads(addTableCMD))</div>
<div>print(result)</div>
<div><br>
</div>
<div>###### testNFTABLES.py --</div>
<div><br>
</div>
<div>Am I mistaken or is this a real bug ?<br>
</div>
<div><br>
</div>
<div>-- System Information:</div>
<div>Debian Release: bullseye/sid</div>
<div>  APT prefers focal-updates</div>
<div>  APT policy: (500, 'focal-updates'), (500, 'focal-security'), (500, 'focal'), (100, 'focal-backports')</div>
<div>Architecture: amd64 (x86_64)</div>
<div>Foreign Architectures: i386</div>
<div><br>
</div>
<div>Kernel: Linux 5.8.0-41-generic (SMP w/4 CPU cores)</div>
<div>Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)</div>
<div>Shell: /bin/sh linked to /usr/bin/dash</div>
<div>Init: systemd (via /run/systemd/system)</div>
<div>LSM: AppArmor: enabled</div>
<div><br>
</div>
<div>Versions of packages python3-nftables depends on:</div>
<div>ii  libnftables1  0.9.3-2</div>
<div>ii  python3       3.8.2-0ubuntu2</div>
<div><br>
</div>
<div>python3-nftables recommends no packages.</div>
<div><br>
</div>
<div>python3-nftables suggests no packages.</div>
<div><br>
</div>
-- no debconf information<br>
</div>
</body>
</html>