path: root/py/
diff options
authorPhil Sutter <>2019-04-02 15:34:43 +0200
committerPablo Neira Ayuso <>2019-04-03 19:58:49 +0200
commit50b5b71ebeee33b725d44ab4487d5d257f9ca4c0 (patch)
treef3c8f4dd6809645a71921359d0229c8ae2bca3c8 /py/
parentf01940d69e2a4d8e9e151da8d4d39f78d08528cf (diff)
parser_json: Rewrite echo support
Instead of guessing which object to update with retrieved handle, introduce a list containing struct cmd <-> json_t associations. Upon batch commit, allocated cmd objects are assigned a unique netlink sequence number. Monitor events contain that number as well, so they may be associated to the cmd object which triggered them. Using json_cmd_assoc list the event may in turn be associated to the input's JSON object which should receive the handle value. This also fixes incorrect behaviour if JSON input contained "insert" commands. Fixes: bb32d8db9a125 ("JSON: Add support for echo option") Signed-off-by: Phil Sutter <> Signed-off-by: Pablo Neira Ayuso <>
Diffstat (limited to 'py/')
1 files changed, 3 insertions, 0 deletions
diff --git a/py/ b/py/
index 6891cb1c..f0716357 100644
--- a/py/
+++ b/py/
@@ -106,6 +106,9 @@ class Nftables:
+ def __del__(self):
+ self.nft_ctx_free(self.__ctx)
def __get_output_flag(self, name):
flag = self.output_flags[name]
return self.nft_ctx_output_get_flags(self.__ctx) & flag