[Bug 1499] New: python3-nftables wrong return code when working with JSON

bugzilla-daemon at netfilter.org bugzilla-daemon at netfilter.org
Fri Feb 12 10:58:09 CET 2021


            Bug ID: 1499
           Summary: python3-nftables wrong return code when working with
           Product: nftables
           Version: unspecified
          Hardware: x86_64
                OS: Debian GNU/Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: nft
          Assignee: pablo at netfilter.org
          Reporter: arturo at netfilter.org

Original bug report in the Debian bug tracker:

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
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()

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))

result = nft.json_cmd(json.loads(getTableCMD))

# Resetting Nftables class instance makes it work
# nft = nftables.Nftables()

result = nft.json_cmd(json.loads(addTableCMD))

###### testNFTABLES.py --

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/20210212/841f4a8f/attachment.html>

More information about the netfilter-buglog mailing list