[<prev] [next>] [day] [month] [year] [list]
Message-Id: <87e48543d091a6851ba1bd62c6fb79cf11a478de.1613952250.git.mkubecek@suse.cz>
Date: Mon, 22 Feb 2021 01:05:24 +0100 (CET)
From: Michal Kubecek <mkubecek@...e.cz>
To: netdev@...r.kernel.org
Cc: Bruce LIU <ccieliu@...il.com>
Subject: [PATCH ethtool] ioctl: less confusing error message for master-slave
parameter
The fallback code issues a reasonable error message when a subcommand
implemented only via netlink would end up being processed by ioctl code,
e.g. because a new ethtool runs on an older kernel without netlink support.
But when a netlink only parameter is passed to subcommand which is
recognized by ioctl code in general, it is handled as an unknown one.
At the the moment, there is only one such parameter: master-slave for
'-s' subcommand. As it is not handled by the generic command line parser,
address this with a quick fix and leave updating the generic parser for
later.
Reported-by: Bruce LIU <ccieliu@...il.com>
Signed-off-by: Michal Kubecek <mkubecek@...e.cz>
---
ethtool.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/ethtool.c b/ethtool.c
index fb90e9e456b9..15e9d34831b3 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -72,6 +72,16 @@ static void exit_bad_args(void)
exit(1);
}
+static void exit_nlonly_param(const char *name) __attribute__((noreturn));
+
+static void exit_nlonly_param(const char *name)
+{
+ fprintf(stderr,
+ "ethtool: parameter '%s' can be used only with netlink\n",
+ name);
+ exit(1);
+}
+
typedef enum {
CMDL_NONE,
CMDL_BOOL,
@@ -3066,6 +3076,8 @@ static int do_sset(struct cmd_context *ctx)
ARRAY_SIZE(cmdline_msglvl));
break;
}
+ } else if (!strcmp(argp[i], "master-slave")) {
+ exit_nlonly_param(argp[i]);
} else {
exit_bad_args();
}
--
2.30.1
Powered by blists - more mailing lists