[ovs-dev] [PATCH v2 08/16] ofp-util: Fix table features decoding of match and mask.

Ben Pfaff blp at nicira.com
Mon Aug 11 19:25:22 UTC 2014


Thanks, applied to master.

On Fri, Aug 08, 2014 at 12:36:03PM -0700, Jarno Rajahalme wrote:
> Acked-by: Jarno Rajahalme <jrajahalme at nicira.com>
> 
> On Aug 7, 2014, at 4:13 PM, Ben Pfaff <blp at nicira.com> wrote:
> 
> > The call to parse_oxms() inside ofputil_decode_table_features() sets only
> > one bit in either 'match' or 'mask' for a given field that is matchable:
> > in 'mask' if the field is arbitrarily maskable or in 'match' otherwise.
> > The code at the end of ofputil_decode_table_features() mishandled this,
> > assuming that an arbitrarily matchable field would have that bit set in
> > both.  This meant that arbitrarily matchable fields were being
> > misinterpreted as not matchable at all.  This commit fixes the problem.
> > 
> > Signed-off-by: Ben Pfaff <blp at nicira.com>
> > ---
> > lib/ofp-util.c |   14 ++++++++------
> > 1 file changed, 8 insertions(+), 6 deletions(-)
> > 
> > diff --git a/lib/ofp-util.c b/lib/ofp-util.c
> > index 1ba3970..9b6ece9 100644
> > --- a/lib/ofp-util.c
> > +++ b/lib/ofp-util.c
> > @@ -4760,15 +4760,17 @@ ofputil_decode_table_features(struct ofpbuf *msg,
> > 
> >     /* Fix inconsistencies:
> >      *
> > -     *     - Turn off 'mask' and 'wildcard' bits that are not in 'match',
> > -     *       because a field must be matchable to be masked or wildcarded.
> > +     *     - Turn on 'match' bits that are set in 'mask', because maskable
> > +     *       fields are matchable.
> >      *
> >      *     - Turn on 'wildcard' bits that are set in 'mask', because a field
> > -     *       that is arbitrarily maskable can be wildcarded entirely. */
> > -    bitmap_and(tf->mask.bm, tf->match.bm, MFF_N_IDS);
> > -    bitmap_and(tf->wildcard.bm, tf->match.bm, MFF_N_IDS);
> > -
> > +     *       that is arbitrarily maskable can be wildcarded entirely.
> > +     *
> > +     *     - Turn off 'wildcard' bits that are not in 'match', because a field
> > +     *       must be matchable for it to be meaningfully wildcarded. */
> > +    bitmap_or(tf->match.bm, tf->mask.bm, MFF_N_IDS);
> >     bitmap_or(tf->wildcard.bm, tf->mask.bm, MFF_N_IDS);
> > +    bitmap_and(tf->wildcard.bm, tf->match.bm, MFF_N_IDS);
> > 
> >     return 0;
> > }
> > -- 
> > 1.7.10.4
> > 
> > _______________________________________________
> > dev mailing list
> > dev at openvswitch.org
> > http://openvswitch.org/mailman/listinfo/dev
> 



More information about the dev mailing list