!19 json: fix base chain output

From: @eaglegai
Reviewed-by: @zengwefeng
Signed-off-by: @zengwefeng
This commit is contained in:
openeuler-ci-bot 2021-08-24 08:37:43 +00:00 committed by Gitee
commit 75556af7cf
2 changed files with 40 additions and 2 deletions

View File

@ -0,0 +1,34 @@
From 790889957b48f4d28dc1699bd6c193617f2141b3 Mon Sep 17 00:00:00 2001
From: Florian Westphal <fw@strlen.de>
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 <fw@strlen.de>
(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

View File

@ -1,6 +1,6 @@
Name: nftables Name: nftables
Version: 0.9.9 Version: 0.9.9
Release: 1 Release: 2
Epoch: 1 Epoch: 1
Summary: A subsystem of the Linux kernel processing network data Summary: A subsystem of the Linux kernel processing network data
License: GPLv2 License: GPLv2
@ -8,6 +8,7 @@ URL: https://netfilter.org/projects/nftables/
Source0: http://ftp.netfilter.org/pub/nftables/nftables-%{version}.tar.bz2 Source0: http://ftp.netfilter.org/pub/nftables/nftables-%{version}.tar.bz2
Source1: nftables.service Source1: nftables.service
Source2: nftables.conf 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: gcc flex bison libmnl-devel gmp-devel readline-devel libnftnl-devel docbook2X systemd
BuildRequires: iptables-devel jansson-devel python3-devel 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. The nftables python module providing an interface to libnftables via ctypes.
%prep %prep
%autosetup -n %{name}-%{version} %autosetup -n %{name}-%{version} -p1
%build %build
%configure --disable-silent-rules --with-xtables --with-json \ %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/ %{python3_sitelib}/nftables/
%changelog %changelog
* Tue Aug 24 2021 gaihuiying <gaihuiying1@huawei.com> - 1:0.9.9-2
- json: fix base chain output
* Fri Jul 23 2021 gaihuiying <gaihuiying1@huawei.com> - 1:0.9.9-1 * Fri Jul 23 2021 gaihuiying <gaihuiying1@huawei.com> - 1:0.9.9-1
- update to 0.9.9 - update to 0.9.9