* [PATCH iproute2] tc: m_bpf: fix next arg selection after tc opcode
@ 2015-03-18 9:13 Daniel Borkmann
2015-03-18 10:00 ` Jiri Pirko
2015-03-24 22:46 ` Stephen Hemminger
0 siblings, 2 replies; 5+ messages in thread
From: Daniel Borkmann @ 2015-03-18 9:13 UTC (permalink / raw)
To: stephen; +Cc: jhs, netdev, Daniel Borkmann
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 <daniel@iogearbox.net>
---
tc/m_bpf.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/tc/m_bpf.c b/tc/m_bpf.c
index 3b864f9..bc6cc47 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++;
}
}
--
1.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH iproute2] tc: m_bpf: fix next arg selection after tc opcode
2015-03-18 9:13 [PATCH iproute2] tc: m_bpf: fix next arg selection after tc opcode Daniel Borkmann
@ 2015-03-18 10:00 ` Jiri Pirko
2015-03-18 10:02 ` Daniel Borkmann
2015-03-24 22:46 ` Stephen Hemminger
1 sibling, 1 reply; 5+ messages in thread
From: Jiri Pirko @ 2015-03-18 10:00 UTC (permalink / raw)
To: Daniel Borkmann; +Cc: stephen, jhs, netdev
Wed, Mar 18, 2015 at 10:13:34AM CET, daniel@iogearbox.net wrote:
>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 <daniel@iogearbox.net>
Thanks for fixing this Daniel.
Acked-by: Jiri Pirko <jiri@resnulli.us>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH iproute2] tc: m_bpf: fix next arg selection after tc opcode
2015-03-18 10:00 ` Jiri Pirko
@ 2015-03-18 10:02 ` Daniel Borkmann
2015-03-18 10:13 ` Jiri Pirko
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Borkmann @ 2015-03-18 10:02 UTC (permalink / raw)
To: Jiri Pirko; +Cc: stephen, jhs, netdev
On 03/18/2015 11:00 AM, Jiri Pirko wrote:
> Wed, Mar 18, 2015 at 10:13:34AM CET, daniel@iogearbox.net wrote:
>> 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 <daniel@iogearbox.net>
>
> Thanks for fixing this Daniel.
Thanks & sorry I forgot to put you in Cc, I realized that too late.
Lack of coffee. ;)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH iproute2] tc: m_bpf: fix next arg selection after tc opcode
2015-03-18 10:02 ` Daniel Borkmann
@ 2015-03-18 10:13 ` Jiri Pirko
0 siblings, 0 replies; 5+ messages in thread
From: Jiri Pirko @ 2015-03-18 10:13 UTC (permalink / raw)
To: Daniel Borkmann; +Cc: stephen, jhs, netdev
Wed, Mar 18, 2015 at 11:02:54AM CET, daniel@iogearbox.net wrote:
>On 03/18/2015 11:00 AM, Jiri Pirko wrote:
>>Wed, Mar 18, 2015 at 10:13:34AM CET, daniel@iogearbox.net wrote:
>>>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 <daniel@iogearbox.net>
>>
>>Thanks for fixing this Daniel.
>
>Thanks & sorry I forgot to put you in Cc, I realized that too late.
It happens, don't worry about that :)
>
>Lack of coffee. ;)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH iproute2] tc: m_bpf: fix next arg selection after tc opcode
2015-03-18 9:13 [PATCH iproute2] tc: m_bpf: fix next arg selection after tc opcode Daniel Borkmann
2015-03-18 10:00 ` Jiri Pirko
@ 2015-03-24 22:46 ` Stephen Hemminger
1 sibling, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2015-03-24 22:46 UTC (permalink / raw)
To: Daniel Borkmann; +Cc: jhs, netdev
On Wed, 18 Mar 2015 10:13:34 +0100
Daniel Borkmann <daniel@iogearbox.net> wrote:
> 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 <daniel@iogearbox.net>
Applied (to master).
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-03-24 22:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-18 9:13 [PATCH iproute2] tc: m_bpf: fix next arg selection after tc opcode Daniel Borkmann
2015-03-18 10:00 ` Jiri Pirko
2015-03-18 10:02 ` Daniel Borkmann
2015-03-18 10:13 ` Jiri Pirko
2015-03-24 22:46 ` Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).