From: Simon Horman <simon.horman@netronome.com>
To: David Ahern <dsahern@gmail.com>
Cc: Zahari Doychev <zahari.doychev@linux.com>,
netdev@vger.kernel.org, jhs@mojatatu.com
Subject: Re: [iproute2-next] tc flower: use right ethertype in icmp/arp parsing
Date: Mon, 26 Oct 2020 09:48:24 +0100 [thread overview]
Message-ID: <20201026084824.GA29950@netronome.com> (raw)
In-Reply-To: <bd0eb394-72a3-1c95-6736-cd47a1d69585@gmail.com>
On Sun, Oct 25, 2020 at 03:18:48PM -0600, David Ahern wrote:
> On 10/19/20 5:47 AM, Zahari Doychev wrote:
> > Currently the icmp and arp prsing functions are called with inccorect
> > ethtype in case of vlan or cvlan filter options. In this case either
> > cvlan_ethtype or vlan_ethtype has to be used.
> >
> > Signed-off-by: Zahari Doychev <zahari.doychev@linux.com>
> > ---
> > tc/f_flower.c | 43 ++++++++++++++++++++++++++-----------------
> > 1 file changed, 26 insertions(+), 17 deletions(-)
> >
> > diff --git a/tc/f_flower.c b/tc/f_flower.c
> > index 00c919fd..dd9f3446 100644
> > --- a/tc/f_flower.c
> > +++ b/tc/f_flower.c
> > @@ -1712,7 +1712,10 @@ static int flower_parse_opt(struct filter_util *qu, char *handle,
> > }
> > } else if (matches(*argv, "type") == 0) {
> > NEXT_ARG();
> > - ret = flower_parse_icmp(*argv, eth_type, ip_proto,
> > + ret = flower_parse_icmp(*argv, cvlan_ethtype ?
> > + cvlan_ethtype : vlan_ethtype ?
> > + vlan_ethtype : eth_type,
> > + ip_proto,
>
> looks correct to me, but would like confirmation of the intent from Simon.
Thanks, this appears to be correct to me as ultimately
the code wants to operate on ETH_P_IP or ETH_P_IPV6 rather
than a VLAN Ether type.
> Also, I am not a fan of the readability of that coding style. Rather
> than repeat that expression multiple times, make a short helper to
> return the relevant eth type and use a temp variable for it. You should
> also comment that relevant eth type changes as arguments are parsed.
>
> Thanks,
>
>
next prev parent reply other threads:[~2020-10-26 8:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-19 11:47 [iproute2-next] tc flower: use right ethertype in icmp/arp parsing Zahari Doychev
2020-10-25 21:18 ` David Ahern
2020-10-26 8:48 ` Simon Horman [this message]
2020-10-27 9:11 ` Zahari Doychev
2020-10-27 14:12 ` David Ahern
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201026084824.GA29950@netronome.com \
--to=simon.horman@netronome.com \
--cc=dsahern@gmail.com \
--cc=jhs@mojatatu.com \
--cc=netdev@vger.kernel.org \
--cc=zahari.doychev@linux.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.