Dear Maintainer,
I am using the python wrapper in a program and faced a problem.
Trying to list a Table while the Ruleset is empty returns an error, no problem yet.
Every subsequent call to json_cmd() on the same nftables.Nftables class instance returns -1 in return code.
Here is a short script reproducing the error :
###### testNFTABLES.py ++
import nftables
import json
nft = nftables.Nftables()
nft.set_json_output(True)
flushRulesetCMD = '{ "nftables": [ { "flush": { "ruleset": null }} ]}'
getTableCMD = '{ "nftables": [ { "list": { "table": { "family": "inet", "name": "FooTable" }}} ]}'
addTableCMD = '{ "nftables": [ { "add": { "table": { "family": "inet", "name": "FooTable" }}} ]}'
result = nft.json_cmd(json.loads(flushRulesetCMD))
print(result)
result = nft.json_cmd(json.loads(getTableCMD))
print(result)
# Resetting Nftables class instance makes it work
# nft = nftables.Nftables()
result = nft.json_cmd(json.loads(addTableCMD))
print(result)
###### testNFTABLES.py --
Am I mistaken or is this a real bug ?