[ovs-dev] [PATCH 02/45] ofproto: As of Open Flow 1.1 switch_features has no capabilities field

Simon Horman horms at verge.net.au
Tue Jul 31 05:16:39 UTC 2012


On Mon, Jul 30, 2012 at 09:41:05PM -0700, Ben Pfaff wrote:
> On Mon, Jul 30, 2012 at 11:03:00AM +0900, Simon Horman wrote:
> > diff --git a/lib/ofp-util.c b/lib/ofp-util.c
> > index a943b4e..b62d944 100644
> > --- a/lib/ofp-util.c
> > +++ b/lib/ofp-util.c
> > @@ -2418,7 +2418,16 @@ ofputil_decode_switch_features(const struct ofp_header *oh,
> >          if (osf->capabilities & htonl(OFPC11_GROUP_STATS)) {
> >              features->capabilities |= OFPUTIL_C_GROUP_STATS;
> >          }
> > -        features->actions = decode_action_bits(osf->actions, of11_action_bits);
> > +        switch ((enum ofp_version)oh->version) {
> > +        case OFP11_VERSION:
> > +        case OFP12_VERSION:
> > +            features->actions = decode_action_bits(UINT32_MAX,
> > +                                                   of11_action_bits);
> > +            break;
> > +        case OFP10_VERSION:
> > +        default:
> > +            NOT_REACHED();
> > +        }
> >      } else {
> >          return OFPERR_OFPBRC_BAD_VERSION;
> >      }
> 
> "sparse" pointed out:
> 
> ../lib/ofp-util.c:2440:52: warning: incorrect type in argument 1 (different base types)
> ../lib/ofp-util.c:2440:52:    expected restricted __be32 [usertype] of_actions
> ../lib/ofp-util.c:2440:52:    got unsigned int
> 
> so I'm going to change UINT32_MAX to htonl(UINT32_MAX).

Thanks, I'll try and remember to run sparse more often.



More information about the dev mailing list