@@ -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();
}
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@gmail.com> Signed-off-by: Michal Kubecek <mkubecek@suse.cz> --- ethtool.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)