[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230728183329.2193688-1-kuba@kernel.org>
Date: Fri, 28 Jul 2023 11:33:29 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: dsahern@...il.com,
stephen@...workplumber.org
Cc: netdev@...r.kernel.org,
Jakub Kicinski <kuba@...nel.org>
Subject: [PATCH iproute2-next] ip: error out if iplink does not consume all options
dummy does not define .parse_opt, which make ip ignore all
trailing arguments, for example:
# ip link add type dummy a b c d e f name cheese
will work just fine (and won't call the device "cheese").
Error out in this case with a clear error message:
# ip link add type dummy a b c d e f name cheese
Garbage instead of arguments "a ...". Try "ip link help".
Signed-off-by: Jakub Kicinski <kuba@...nel.org>
---
ip/iplink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ip/iplink.c b/ip/iplink.c
index 6c5d13d53a84..f60cff9c4b5f 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -1112,7 +1112,7 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
argc -= ret;
argv += ret;
- if (lu && argc) {
+ if (lu && lu->parse_opt && argc) {
struct rtattr *data;
data = addattr_nest(&req.n, sizeof(req), iflatype);
--
2.41.0
Powered by blists - more mailing lists