Acked-by: Andy Zhou <az...@nicira.com>
On Thu, Apr 16, 2015 at 11:28 AM, Ben Pfaff <b...@nicira.com> wrote: > Otherwise you get an assertion failure in place of a helpful error message. > > Also fix a nearby style violation and add a pair of tests to prevent > regression. > > Found by LLVM scan-build. > > Reported-by: Kevin Lo <ke...@freebsd.org> > Signed-off-by: Ben Pfaff <b...@nicira.com> > --- > lib/ofp-util.c | 4 +++- > tests/ofproto.at | 10 ++++++++++ > 2 files changed, 13 insertions(+), 1 deletion(-) > > diff --git a/lib/ofp-util.c b/lib/ofp-util.c > index 277fdfe..2eb199f 100644 > --- a/lib/ofp-util.c > +++ b/lib/ofp-util.c > @@ -8170,7 +8170,8 @@ ofputil_encode_ofp15_group_mod(enum ofp_version > ofp_version, > } > > static void > -bad_group_cmd(enum ofp15_group_mod_command cmd) { > +bad_group_cmd(enum ofp15_group_mod_command cmd) > +{ > const char *opt_version; > const char *version; > const char *cmd_str; > @@ -8187,6 +8188,7 @@ bad_group_cmd(enum ofp15_group_mod_command cmd) { > case OFPGC15_REMOVE_BUCKET: > version = "1.5"; > opt_version = "15"; > + break; > > default: > OVS_NOT_REACHED(); > diff --git a/tests/ofproto.at b/tests/ofproto.at > index 5ae3139..d64b280 100644 > --- a/tests/ofproto.at > +++ b/tests/ofproto.at > @@ -454,6 +454,11 @@ AT_CHECK([STRIP_XIDS stdout], [0], [dnl > OFPST_GROUP_DESC reply (OF1.5): > > group_id=1234,type=all,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1,bucket=bucket_id:10,actions=output:10,bucket=bucket_id:11,actions=output:11,bucket=bucket_id:12,actions=output:12,bucket=bucket_id:13,actions=output:13,bucket=bucket_id:14,actions=output:14,bucket=bucket_id:15,actions=output:15,bucket=bucket_id:20,actions=output:20,bucket=bucket_id:21,actions=output:21 > ]) > + > +# Negative check. > +AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn insert-buckets br0 > group_id=1234,command_bucket_id=first,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1], > [1], [], > + [insert-bucket needs OpenFlow 1.5 or later ('-O OpenFlow15') > +]) > OVS_VSWITCHD_STOP > AT_CLEANUP > > @@ -508,6 +513,11 @@ OFPT_GROUP_MOD (OF1.5): > REMOVE_BUCKET command_bucket_id:1,group_id=1234 > ]) > OVS_VSWITCHD_STOP > + > +# Negative check. > +AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn remove-buckets br0 > group_id=1234,command_bucket_id=last], [1], [], > + [ovs-ofctl: insert-bucket needs OpenFlow 1.5 or later ('-O OpenFlow15') > +]) > AT_CLEANUP > > dnl This is really bare-bones. > -- > 2.1.3 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > http://openvswitch.org/mailman/listinfo/dev _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev