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: 86ab59a666 ("tc: add support for BPF based actions")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Jiri Pirko <jiri@resnulli.us>
This commit is contained in:
Daniel Borkmann 2015-03-18 10:13:34 +01:00 committed by Stephen Hemminger
parent 599fc319eb
commit 51cf36756c
1 changed files with 10 additions and 5 deletions

View File

@ -89,20 +89,25 @@ static int parse_bpf(struct action_util *a, int *argc_p, char ***argv_p,
if (argc) { if (argc) {
if (matches(*argv, "reclassify") == 0) { if (matches(*argv, "reclassify") == 0) {
parm.action = TC_ACT_RECLASSIFY; parm.action = TC_ACT_RECLASSIFY;
NEXT_ARG(); argc--;
argv++;
} else if (matches(*argv, "pipe") == 0) { } else if (matches(*argv, "pipe") == 0) {
parm.action = TC_ACT_PIPE; parm.action = TC_ACT_PIPE;
NEXT_ARG(); argc--;
argv++;
} else if (matches(*argv, "drop") == 0 || } else if (matches(*argv, "drop") == 0 ||
matches(*argv, "shot") == 0) { matches(*argv, "shot") == 0) {
parm.action = TC_ACT_SHOT; parm.action = TC_ACT_SHOT;
NEXT_ARG(); argc--;
argv++;
} else if (matches(*argv, "continue") == 0) { } else if (matches(*argv, "continue") == 0) {
parm.action = TC_ACT_UNSPEC; parm.action = TC_ACT_UNSPEC;
NEXT_ARG(); argc--;
argv++;
} else if (matches(*argv, "pass") == 0) { } else if (matches(*argv, "pass") == 0) {
parm.action = TC_ACT_OK; parm.action = TC_ACT_OK;
NEXT_ARG(); argc--;
argv++;
} }
} }