All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH iproute2 net] tc: remove duplicated NEXT_ARG_FWD() in parse_ct()
@ 2019-10-29 17:53 Vlad Buslov
  2019-10-29 18:08 ` Marcelo Ricardo Leitner
  2019-11-01 16:37 ` Stephen Hemminger
  0 siblings, 2 replies; 3+ messages in thread
From: Vlad Buslov @ 2019-10-29 17:53 UTC (permalink / raw)
  To: netdev; +Cc: davem, mleitner, paulb, Vlad Buslov

Function parse_ct() manually calls NEXT_ARG_FWD() after
parse_action_control_dflt(). This is redundant because
parse_action_control_dflt() modifies argc and argv itself. Moreover, such
implementation parses out any following actions option. For example, adding
action ct with cookie errors:

$ sudo tc actions add action ct cookie 111111111111
Bad action type 111111111111
Usage: ... gact <ACTION> [RAND] [INDEX]
Where:  ACTION := reclassify | drop | continue | pass | pipe |
                  goto chain <CHAIN_INDEX> | jump <JUMP_COUNT>
        RAND := random <RANDTYPE> <ACTION> <VAL>
        RANDTYPE := netrand | determ
        VAL : = value not exceeding 10000
        JUMP_COUNT := Absolute jump from start of action list
        INDEX := index value used

With fix:

$ sudo tc actions add action ct cookie 111111111111
$ sudo tc actions list action ct
total acts 1

        action order 0: ct zone 0 pipe
         index 1 ref 1 bind 0
        cookie 111111111111

Fixes: c8a494314c40 ("tc: Introduce tc ct action")
Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
---
 tc/m_ct.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tc/m_ct.c b/tc/m_ct.c
index 8589cb9a3c51..d79eb5e361ac 100644
--- a/tc/m_ct.c
+++ b/tc/m_ct.c
@@ -316,7 +316,6 @@ parse_ct(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
 
 	parse_action_control_dflt(&argc, &argv, &sel.action, false,
 				  TC_ACT_PIPE);
-	NEXT_ARG_FWD();
 
 	addattr16(n, MAX_MSG, TCA_CT_ACTION, ct_action);
 	addattr_l(n, MAX_MSG, TCA_CT_PARMS, &sel, sizeof(sel));
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH iproute2 net] tc: remove duplicated NEXT_ARG_FWD() in parse_ct()
  2019-10-29 17:53 [PATCH iproute2 net] tc: remove duplicated NEXT_ARG_FWD() in parse_ct() Vlad Buslov
@ 2019-10-29 18:08 ` Marcelo Ricardo Leitner
  2019-11-01 16:37 ` Stephen Hemminger
  1 sibling, 0 replies; 3+ messages in thread
From: Marcelo Ricardo Leitner @ 2019-10-29 18:08 UTC (permalink / raw)
  To: Vlad Buslov; +Cc: netdev, davem, paulb

On Tue, Oct 29, 2019 at 07:53:46PM +0200, Vlad Buslov wrote:
> Function parse_ct() manually calls NEXT_ARG_FWD() after
> parse_action_control_dflt(). This is redundant because
> parse_action_control_dflt() modifies argc and argv itself. Moreover, such
> implementation parses out any following actions option. For example, adding
> action ct with cookie errors:
> 
> $ sudo tc actions add action ct cookie 111111111111
> Bad action type 111111111111
> Usage: ... gact <ACTION> [RAND] [INDEX]
> Where:  ACTION := reclassify | drop | continue | pass | pipe |
>                   goto chain <CHAIN_INDEX> | jump <JUMP_COUNT>
>         RAND := random <RANDTYPE> <ACTION> <VAL>
>         RANDTYPE := netrand | determ
>         VAL : = value not exceeding 10000
>         JUMP_COUNT := Absolute jump from start of action list
>         INDEX := index value used
> 
> With fix:
> 
> $ sudo tc actions add action ct cookie 111111111111
> $ sudo tc actions list action ct
> total acts 1
> 
>         action order 0: ct zone 0 pipe
>          index 1 ref 1 bind 0
>         cookie 111111111111
> 
> Fixes: c8a494314c40 ("tc: Introduce tc ct action")
> Signed-off-by: Vlad Buslov <vladbu@mellanox.com>

Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

Thanks Vlad.

> ---
>  tc/m_ct.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/tc/m_ct.c b/tc/m_ct.c
> index 8589cb9a3c51..d79eb5e361ac 100644
> --- a/tc/m_ct.c
> +++ b/tc/m_ct.c
> @@ -316,7 +316,6 @@ parse_ct(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
>  
>  	parse_action_control_dflt(&argc, &argv, &sel.action, false,
>  				  TC_ACT_PIPE);
> -	NEXT_ARG_FWD();
>  
>  	addattr16(n, MAX_MSG, TCA_CT_ACTION, ct_action);
>  	addattr_l(n, MAX_MSG, TCA_CT_PARMS, &sel, sizeof(sel));
> -- 
> 2.21.0
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH iproute2 net] tc: remove duplicated NEXT_ARG_FWD() in parse_ct()
  2019-10-29 17:53 [PATCH iproute2 net] tc: remove duplicated NEXT_ARG_FWD() in parse_ct() Vlad Buslov
  2019-10-29 18:08 ` Marcelo Ricardo Leitner
@ 2019-11-01 16:37 ` Stephen Hemminger
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2019-11-01 16:37 UTC (permalink / raw)
  To: Vlad Buslov; +Cc: netdev, davem, mleitner, paulb

On Tue, 29 Oct 2019 19:53:46 +0200
Vlad Buslov <vladbu@mellanox.com> wrote:

> Function parse_ct() manually calls NEXT_ARG_FWD() after
> parse_action_control_dflt(). This is redundant because
> parse_action_control_dflt() modifies argc and argv itself. Moreover, such
> implementation parses out any following actions option. For example, adding
> action ct with cookie errors:
> 
> $ sudo tc actions add action ct cookie 111111111111
> Bad action type 111111111111
> Usage: ... gact <ACTION> [RAND] [INDEX]
> Where:  ACTION := reclassify | drop | continue | pass | pipe |
>                   goto chain <CHAIN_INDEX> | jump <JUMP_COUNT>
>         RAND := random <RANDTYPE> <ACTION> <VAL>
>         RANDTYPE := netrand | determ
>         VAL : = value not exceeding 10000
>         JUMP_COUNT := Absolute jump from start of action list
>         INDEX := index value used
> 
> With fix:
> 
> $ sudo tc actions add action ct cookie 111111111111
> $ sudo tc actions list action ct
> total acts 1
> 
>         action order 0: ct zone 0 pipe
>          index 1 ref 1 bind 0
>         cookie 111111111111
> 
> Fixes: c8a494314c40 ("tc: Introduce tc ct action")
> Signed-off-by: Vlad Buslov <vladbu@mellanox.com>

Applied

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-01 16:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-29 17:53 [PATCH iproute2 net] tc: remove duplicated NEXT_ARG_FWD() in parse_ct() Vlad Buslov
2019-10-29 18:08 ` Marcelo Ricardo Leitner
2019-11-01 16:37 ` Stephen Hemminger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.