[ovs-dev] [PATCH] ofproto: Use ofproto_check_ofpacts() from modify_flows__().

Ben Pfaff blp at nicira.com
Fri Oct 25 21:24:25 UTC 2013


Applied, thanks.

On Fri, Oct 25, 2013 at 02:01:01PM -0700, Jarno Rajahalme wrote:
> Nice clean-up too :-)
> 
> Acked-by: Jarno Rajahalme <jrajahalme at nicira.com>
> 
> On Oct 25, 2013, at 1:53 PM, Ben Pfaff <blp at nicira.com> wrote:
> 
> > Until now this code has called ofpacts_check() directly, but that omits
> > the additional check that the ofproto_check_ofpacts() wrapper includes.
> > 
> > Reported-by: Jarno Rajahalme <jrajahalme at nicira.com>
> > Signed-off-by: Ben Pfaff <blp at nicira.com>
> > ---
> > ofproto/ofproto.c |   16 +++++++---------
> > 1 file changed, 7 insertions(+), 9 deletions(-)
> > 
> > diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
> > index 1d340c9..91a39ef 100644
> > --- a/ofproto/ofproto.c
> > +++ b/ofproto/ofproto.c
> > @@ -2824,14 +2824,14 @@ static enum ofperr
> > ofproto_check_ofpacts(struct ofproto *ofproto,
> >                       const struct ofpact ofpacts[], size_t ofpacts_len,
> >                       struct flow *flow, uint8_t table_id,
> > -                      bool enforce_consistency)
> > +                      const struct ofp_header *oh)
> > {
> >     enum ofperr error;
> >     uint32_t mid;
> > 
> >     error = ofpacts_check(ofpacts, ofpacts_len, flow,
> >                           u16_to_ofp(ofproto->max_ports), table_id,
> > -                          enforce_consistency);
> > +                          oh && oh->version > OFP10_VERSION);
> >     if (error) {
> >         return error;
> >     }
> > @@ -2889,8 +2889,7 @@ handle_packet_out(struct ofconn *ofconn, const struct ofp_header *oh)
> >     /* Verify actions against packet, then send packet if successful. */
> >     in_port_.ofp_port = po.in_port;
> >     flow_extract(payload, 0, 0, NULL, &in_port_, &flow);
> > -    error = ofproto_check_ofpacts(p, po.ofpacts, po.ofpacts_len, &flow, 0,
> > -                                  oh->version > OFP10_VERSION);
> > +    error = ofproto_check_ofpacts(p, po.ofpacts, po.ofpacts_len, &flow, 0, oh);
> >     if (!error) {
> >         error = p->ofproto_class->packet_out(p, payload, &flow,
> >                                              po.ofpacts, po.ofpacts_len);
> > @@ -3940,8 +3939,7 @@ add_flow(struct ofproto *ofproto, struct ofconn *ofconn,
> > 
> >     /* Verify actions. */
> >     error = ofproto_check_ofpacts(ofproto, fm->ofpacts, fm->ofpacts_len,
> > -                                  &fm->match.flow, table_id,
> > -                                  request && request->version > OFP10_VERSION);
> > +                                  &fm->match.flow, table_id, request);
> >     if (error) {
> >         cls_rule_destroy(&cr);
> >         return error;
> > @@ -4050,9 +4048,9 @@ modify_flows__(struct ofproto *ofproto, struct ofconn *ofconn,
> >     for (i = 0; i < rules->n; i++) {
> >         struct rule *rule = rules->rules[i];
> > 
> > -        error = ofpacts_check(fm->ofpacts, fm->ofpacts_len, &fm->match.flow,
> > -                              u16_to_ofp(ofproto->max_ports), rule->table_id,
> > -                              request && request->version > OFP10_VERSION);
> > +        error = ofproto_check_ofpacts(ofproto, fm->ofpacts, fm->ofpacts_len,
> > +                                      &fm->match.flow, rule->table_id,
> > +                                      request);
> >         if (error) {
> >             return error;
> >         }
> > -- 
> > 1.7.10.4
> > 
> 



More information about the dev mailing list