From a7682716fb74283ad254ec79fcd416ef779526c6 Mon Sep 17 00:00:00 2001 From: Mohammad Heib Date: Fri, 1 Aug 2025 11:43:05 +0300 Subject: [PATCH] netlink: fix missing headers in text output. Resolves: RHEL-106544 Signed-off-by: Mohammad Heib --- ...k-fix-missing-headers-in-text-output.patch | 64 +++++++++++++++++++ ethtool.spec | 9 ++- 2 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 0001-netlink-fix-missing-headers-in-text-output.patch diff --git a/0001-netlink-fix-missing-headers-in-text-output.patch b/0001-netlink-fix-missing-headers-in-text-output.patch new file mode 100644 index 0000000..5abebe1 --- /dev/null +++ b/0001-netlink-fix-missing-headers-in-text-output.patch @@ -0,0 +1,64 @@ +From b70c928661024cd07914feb49122275daab904ea Mon Sep 17 00:00:00 2001 +From: Jakub Kicinski +Date: Sat, 12 Jul 2025 07:51:05 -0700 +Subject: [PATCH] netlink: fix missing headers in text output + +The commit under fixes added a NULL-check which prevents us from +printing text headers. Conversions to add JSON support often use: + + print_string(PRINT_FP, NULL, "some text:\n", NULL); + +to print in plain text mode. + +Correct output: + + Channel parameters for vpn0: + Pre-set maximums: + RX: n/a + TX: n/a + Other: n/a + Combined: 1 + Current hardware settings: + RX: n/a + TX: n/a + Other: n/a + Combined: 0 + +With the buggy patch: + + Channel parameters for vpn0: + RX: n/a + TX: n/a + Other: n/a + Combined: 1 + RX: n/a + TX: n/a + Other: n/a + Combined: 0 + +Fixes: fd328ccb3cc0 ("json_print: add NULL check before jsonw_string_field() in print_string()") +Signed-off-by: Jakub Kicinski +--- + json_print.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/json_print.c b/json_print.c +index 4f61640..e07c651 100644 +--- a/json_print.c ++++ b/json_print.c +@@ -143,10 +143,11 @@ void print_string(enum output_type type, + } else if (_IS_FP_CONTEXT(type)) { + if (value) + fprintf(stdout, fmt, value); ++ else ++ fprintf(stdout, "%s", fmt); + } + } + +- + /* + * value's type is bool. When using this function in FP context you can't pass + * a value to it, you will need to use "is_json_context()" to have different +-- +2.49.0 + diff --git a/ethtool.spec b/ethtool.spec index 6f76707..14a2d81 100644 --- a/ethtool.spec +++ b/ethtool.spec @@ -2,13 +2,14 @@ Summary: Settings tool for Ethernet NICs Name: ethtool Epoch: 2 Version: 6.15 -Release: 1%{?dist} +Release: 2%{?dist} # {json_print,qsfp,sff-common}.{c,h} are GPL-2.0-or-later, rest is GPL-2.0-only License: GPL-2.0-only AND GPL-2.0-or-later URL: https://www.kernel.org/pub/software/network/%{name}/ Source0: https://www.kernel.org/pub/software/network/%{name}/%{name}-%{version}.tar.xz Source1: https://www.kernel.org/pub/software/network/%{name}/%{name}-%{version}.tar.sign Source2: https://keys.openpgp.org/vks/v1/by-fingerprint/D2CB120AB45957B721CD9596F4554567B91DE934 +Patch0: 0001-netlink-fix-missing-headers-in-text-output.patch BuildRequires: gnupg2, xz BuildRequires: gcc BuildRequires: libmnl-devel @@ -22,7 +23,7 @@ network devices, especially of Ethernet devices. %prep xzcat '%{SOURCE0}' | %{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data=- -%autosetup +%autosetup -p1 %build %configure @@ -45,6 +46,10 @@ make check %{_datadir}/metainfo/org.kernel.software.network.ethtool.metainfo.xml %changelog +* Fri Aug 01 2025 Mohammad Heib +- netlink: fix missing headers in text output. + Resolves: RHEL-106544 + * Tue Jun 24 2025 Mohammad Heib - 2:6.15-1 - Update to latest upstream release v6.15. Resolves RHEL-99667.