From 9236f7968ba26f1008206977f02f103ad3a3bbb4 Mon Sep 17 00:00:00 2001 From: Mohammad Heib Date: Fri, 1 Aug 2025 01:11:00 +0300 Subject: [PATCH] netlink: fix missing headers in text output. Resolves: RHEL-106540 Signed-off-by: Mohammad Heib --- ...k-fix-missing-headers-in-text-output.patch | 64 +++++++++++++++++++ ethtool.spec | 8 ++- 2 files changed, 71 insertions(+), 1 deletion(-) 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 a65ab60..3788c6c 100644 --- a/ethtool.spec +++ b/ethtool.spec @@ -2,12 +2,13 @@ Summary: Settings tool for Ethernet NICs Name: ethtool Epoch: 2 Version: 6.15 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2 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: gpgkey-D2CB120AB45957B721CD9596F4554567B91DE934.gpg +Patch0: 0001-netlink-fix-missing-headers-in-text-output.patch BuildRequires: gnupg2, xz BuildRequires: gcc BuildRequires: libmnl-devel @@ -22,6 +23,7 @@ network devices, especially of Ethernet devices. %prep xzcat '%{SOURCE0}' | %{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data=- %setup -q +%autosetup -p1 %build %configure @@ -44,6 +46,10 @@ make check %{_datadir}/metainfo/org.kernel.software.network.ethtool.metainfo.xml %changelog +* Thu Jul 31 2025 Mohammad Heib - 2:6.15-2 +- netlink: fix missing headers in text output. + Resolves: RHEL-106540 + * Tue Jun 24 2025 Mohammad Heib - 2:6.15-1 - Update to latest upstream release v6.15. Resolves: RHEL-94954