- fix netlink error suppression

OBS-URL: https://build.opensuse.org/package/show/network:utilities/ethtool?expand=0&rev=98
This commit is contained in:
Michal Kubeček 2020-06-12 10:24:49 +00:00 committed by Git OBS Bridge
parent 7fbfad3245
commit 8638bb85d4
3 changed files with 47 additions and 0 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Jun 12 10:19:38 UTC 2020 - Michal Kubecek <mkubecek@suse.cz>
- prevent misleading netlink error message when running on kernel
without ethtool netlink support:
netlink-fix-error-message-suppression.patch
-------------------------------------------------------------------
Sun Jun 7 19:55:27 UTC 2020 - Michal Kubecek <mkubecek@suse.cz>

View File

@ -35,6 +35,7 @@ BuildRequires: pkgconfig(libmnl)
Patch1: netlink-fix-build-warnings.patch
Patch2: netlink-fix-unwanted-switch-fall-through-in-family_i.patch
Patch3: netlink-fix-error-message-suppression.patch
%description
Ethtool is a small utility for examining and tuning ethernet-based
@ -44,6 +45,7 @@ network interfaces. See the man page for more details.
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build
export CFLAGS="%optflags -W -Wall -Wstrict-prototypes -Wformat-security -Wpointer-arith -Wno-missing-field-initializers"

View File

@ -0,0 +1,38 @@
From: Michal Kubecek <mkubecek@suse.cz>
Date: Wed, 10 Jun 2020 13:47:34 +0200
Subject: netlink: fix error message suppression
Patch-mainline: v5.8
Git-commit: a4d9db29f8326d68762dbc0f78ad6f1aa4f29887
Rewrite of nlsock_process_reply() used a bool variable to store the value
of nlctx->suppress_nlerr before passing to nlsock_process_ack(). This
causes the value of 2 (suppress all error/warning messages) to be converted
to 1 (suppress only -EOPNOTSUPP). As a result, -ENOENT returned by failed
genetlink family lookup when running on kernel without ethtool netlink
support is not ignored and misleading "netlink error: No such file or
directory" message is issued even if the ioctl fallback works as expected.
Fixes: 76bdf9372824 ("netlink: use pretty printing for ethtool netlink messages")
Reported-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
---
netlink/nlsock.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/netlink/nlsock.c
+++ b/netlink/nlsock.c
@@ -255,12 +255,12 @@ int nlsock_process_reply(struct nl_socket *nlsk, mnl_cb_t reply_cb, void *data)
nlhdr = (struct nlmsghdr *)buff;
if (nlhdr->nlmsg_type == NLMSG_ERROR) {
- bool silent = nlsk->nlctx->suppress_nlerr;
+ unsigned int suppress = nlsk->nlctx->suppress_nlerr;
bool pretty;
pretty = debug_on(nlsk->nlctx->ctx->debug,
DEBUG_NL_PRETTY_MSG);
- return nlsock_process_ack(nlhdr, len, silent, pretty);
+ return nlsock_process_ack(nlhdr, len, suppress, pretty);
}
msgbuff->nlhdr = nlhdr;