From: Daniel Borkmann Date: Wed, 18 Mar 2015 09:13:34 +0000 (+0100) Subject: tc: m_bpf: fix next arg selection after tc opcode X-Git-Tag: v4.0.0~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51cf36756cd77c27fa07f8be23c7c4e3997fee95;p=thirdparty%2Fiproute2.git tc: m_bpf: fix next arg selection after tc opcode Next argument after the tc opcode/verdict is optional, using NEXT_ARG() requires to have another argument after that one otherwise tc will bail out. Therefore, we need to advance to the next argument manually as done elsewhere. Fixes: 86ab59a6660f ("tc: add support for BPF based actions") Signed-off-by: Daniel Borkmann Acked-by: Jiri Pirko --- diff --git a/tc/m_bpf.c b/tc/m_bpf.c index 3b864f9d9..bc6cc47ad 100644 --- a/tc/m_bpf.c +++ b/tc/m_bpf.c @@ -89,20 +89,25 @@ static int parse_bpf(struct action_util *a, int *argc_p, char ***argv_p, if (argc) { if (matches(*argv, "reclassify") == 0) { parm.action = TC_ACT_RECLASSIFY; - NEXT_ARG(); + argc--; + argv++; } else if (matches(*argv, "pipe") == 0) { parm.action = TC_ACT_PIPE; - NEXT_ARG(); + argc--; + argv++; } else if (matches(*argv, "drop") == 0 || matches(*argv, "shot") == 0) { parm.action = TC_ACT_SHOT; - NEXT_ARG(); + argc--; + argv++; } else if (matches(*argv, "continue") == 0) { parm.action = TC_ACT_UNSPEC; - NEXT_ARG(); + argc--; + argv++; } else if (matches(*argv, "pass") == 0) { parm.action = TC_ACT_OK; - NEXT_ARG(); + argc--; + argv++; } }