[ovs-dev] [PATCH 1/4] lib/tc: Handle ttl for ipv6 too

Simon Horman simon.horman at netronome.com
Thu Jul 26 20:20:20 UTC 2018


On Thu, Jul 26, 2018 at 05:54:51PM +0300, Or Gerlitz wrote:
> On Thu, Jul 26, 2018 at 5:41 PM, Simon Horman
> <simon.horman at netronome.com> wrote:
> > On Wed, Jul 25, 2018 at 09:20:06PM +0300, Or Gerlitz wrote:
> >> TTL can and should be used to match on IPv6's hop-limit, fix that.
> 
> >> Fixes: ab7ecf266b0a ('netdev-tc-offloads: Add nw_ttl matching using flower')
> >> Fixes: 0b4b5203d12e ('tc: Add ip layer ttl matching')
> 
> >> --- a/lib/netdev-tc-offloads.c
> >> +++ b/lib/netdev-tc-offloads.c
> >> @@ -1025,8 +1025,10 @@ netdev_tc_flow_put(struct netdev *netdev, struct match *match,
> >>      if (is_ip_any(key)) {
> >>          flower.key.ip_proto = key->nw_proto;
> >>          flower.mask.ip_proto = mask->nw_proto;
> >> +        mask->nw_proto = 0;
> >>          flower.key.ip_ttl = key->nw_ttl;
> >>          flower.mask.ip_ttl = mask->nw_ttl;
> >> +        mask->nw_ttl = 0;
> >>
> >>          if (mask->nw_frag & FLOW_NW_FRAG_ANY) {
> >>              flower.mask.flags |= TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT;
> >> @@ -1073,8 +1075,6 @@ netdev_tc_flow_put(struct netdev *netdev, struct match *match,
> >>          }
> >>
> >>          mask->nw_tos = 0;
> >> -        mask->nw_proto = 0;
> >> -        mask->nw_ttl = 0;
> >
> > I'm not sure that I understand the purpose of the changes above.
> > They seem to shuffle setting two mask values from one place to another.
> > But what is the effect of this?
> 
> Setting mask->zzz to 0 means we consumed (== set into the mask
> of the tc rule) the zzz field. The convention in the code is to have
> this zeroing near the spot where you consume the field, I aligned
> this code to that convention while fixing the bug.

Understood, likewise for my similar comment on patch #2.


More information about the dev mailing list