Subject: Re: [PATCH iproute2 net-next] tc: m_mirred: Fix parsing of 'index' optional argument

From: Stephen Hemminger <[email-masked]>
Date: Wed, 26 Oct 2016 11:23:02 -0700

On Fri, 21 Oct 2016 23:01:15 +0300
Shmulik Ladkani <[email-masked]> wrote:

> Code in parse_mirred() suggests "index" argument can be placed either
> after the "egress" clause, or as the first argument (after "action mirred").
> 
> However, parse_egress() fails to correctly parse "index" if it's the
> first argument.
> 
> For example:
> 
>  # tc filter add ... action mirred index 5
>  RTNETLINK answers: Invalid argument
>  (unnecessary RTNETLINK issued, should have been parse error)
> 
>  # tc filter add ... action mirred index 5 egress redirect dev eth0
>  bad action type egress
>  (should have been parsed successfully)
> 
> Fix parse_egress as follows:
>  - continue parsing after valid "index" is seen
>  - don't issue the RTNETLINK unless valid "egress" is seen
> 
> Signed-off-by: Shmulik Ladkani <[email-masked]>

Looks like a good fix but does not apply cleanly to current net-next branch.

Please cleanup and resubmit.