diff --git a/backport-json-fix-base-chain-output.patch b/backport-json-fix-base-chain-output.patch new file mode 100644 index 0000000..96093fd --- /dev/null +++ b/backport-json-fix-base-chain-output.patch @@ -0,0 +1,34 @@ +From 790889957b48f4d28dc1699bd6c193617f2141b3 Mon Sep 17 00:00:00 2001 +From: Florian Westphal +Date: Wed, 2 Jun 2021 12:47:24 +0200 +Subject: json: fix base chain output + +nft-test.py -j fails with +python: json.c:243: chain_print_json: Assertion `__out' failed. + +The member was changed from char * to a struct, pass the name again. + +Fixes: 5008798157e2114f ("libnftables: location-based error reporting for chain type") +Signed-off-by: Florian Westphal +(cherry picked from commit cabe8992b3ee4eb0001a07075b317d966df6bcbd) +--- + src/json.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +(limited to 'src/json.c') + +diff --git a/src/json.c b/src/json.c +index a3d1008f..e588ef4c 100644 +--- a/src/json.c ++++ b/src/json.c +@@ -241,7 +241,7 @@ static json_t *chain_print_json(const struct chain *chain) + mpz_export_data(&policy, chain->policy->value, + BYTEORDER_HOST_ENDIAN, sizeof(int)); + tmp = json_pack("{s:s, s:s, s:i, s:s}", +- "type", chain->type, ++ "type", chain->type.str, + "hook", hooknum2str(chain->handle.family, + chain->hook.num), + "prio", priority, +-- +cgit v1.2.3 diff --git a/nftables.spec b/nftables.spec index 21a6ae5..f3e39bb 100644 --- a/nftables.spec +++ b/nftables.spec @@ -1,6 +1,6 @@ Name: nftables Version: 0.9.9 -Release: 1 +Release: 2 Epoch: 1 Summary: A subsystem of the Linux kernel processing network data License: GPLv2 @@ -8,6 +8,7 @@ URL: https://netfilter.org/projects/nftables/ Source0: http://ftp.netfilter.org/pub/nftables/nftables-%{version}.tar.bz2 Source1: nftables.service Source2: nftables.conf +Patch0: backport-json-fix-base-chain-output.patch BuildRequires: gcc flex bison libmnl-devel gmp-devel readline-devel libnftnl-devel docbook2X systemd BuildRequires: iptables-devel jansson-devel python3-devel @@ -34,7 +35,7 @@ Requires: %{name} = %{epoch}:%{version}-%{release} The nftables python module providing an interface to libnftables via ctypes. %prep -%autosetup -n %{name}-%{version} +%autosetup -n %{name}-%{version} -p1 %build %configure --disable-silent-rules --with-xtables --with-json \ @@ -95,6 +96,9 @@ mv $RPM_BUILD_ROOT/%{_datadir}/nftables/*.nft $RPM_BUILD_ROOT/%{_sysconfdir}/nft %{python3_sitelib}/nftables/ %changelog +* Tue Aug 24 2021 gaihuiying - 1:0.9.9-2 +- json: fix base chain output + * Fri Jul 23 2021 gaihuiying - 1:0.9.9-1 - update to 0.9.9