ip: error out if iplink does not consume all options
Subsystems (2)
Jakub Kicinski
maintainerPATCH v2 1/1 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".
---
v2:
- remove the ->parse_opt check later
v1: https://lore.kernel.org/all/[email protected]/
--- ip/iplink.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
ip/iplink.c +2 -3
@@ -1112,13 +1112,12 @@ 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); -if (lu->parse_opt && - lu->parse_opt (lu, argc, argv, &req.n)) +if (lu->parse_opt (lu, argc, argv, &req.n))return -1 ;addattr_nest_end (&req.n, data);
Signature · 1 line
2.41.0
This patch was applied to iproute2/iproute2.git (main) by Stephen Hemminger <[email protected]>:
Hello:
This patch was applied to iproute2/iproute2.git (main) by Stephen Hemminger <[email protected]>:
Quoted 9 lines · On Mon, 31 Jul 2023 09:19:20 -0700 you wrote:
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 cheesewill work just fine (and won't call the device "cheese"). Error out in this case with a clear error message:
[...]
Here is the summary with links:
- [iproute2-next,v2] ip: error out if iplink does not consume all options
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=84ffffeb0a2f
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html