From 8638bb85d426559ad7c78e1980b583aa7299f8511f63e31faeee677151793459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kube=C4=8Dek?= Date: Fri, 12 Jun 2020 10:24:49 +0000 Subject: [PATCH] - fix netlink error suppression OBS-URL: https://build.opensuse.org/package/show/network:utilities/ethtool?expand=0&rev=98 --- ethtool.changes | 7 ++++ ethtool.spec | 2 ++ netlink-fix-error-message-suppression.patch | 38 +++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 netlink-fix-error-message-suppression.patch diff --git a/ethtool.changes b/ethtool.changes index ec7d2bd..d512410 100644 --- a/ethtool.changes +++ b/ethtool.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Jun 12 10:19:38 UTC 2020 - Michal Kubecek + +- 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 diff --git a/ethtool.spec b/ethtool.spec index 8154220..bde82ed 100644 --- a/ethtool.spec +++ b/ethtool.spec @@ -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" diff --git a/netlink-fix-error-message-suppression.patch b/netlink-fix-error-message-suppression.patch new file mode 100644 index 0000000..17ba709 --- /dev/null +++ b/netlink-fix-error-message-suppression.patch @@ -0,0 +1,38 @@ +From: Michal Kubecek +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 +Signed-off-by: Michal Kubecek +--- + 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;