[ovs-dev] [PATCH] ofp-parse: Properly report error for invalid bucket ID.
Ben Pfaff
blp at nicira.com
Fri Apr 17 16:31:30 UTC 2015
Thanks, applied.
On Thu, Apr 16, 2015 at 03:02:10PM -0700, Jarno Rajahalme wrote:
> Acked-by: Jarno Rajahalme <jrajahalme at nicira.com>
>
> > On Apr 16, 2015, at 1:40 PM, Ben Pfaff <blp at nicira.com> wrote:
> >
> > The inner 'error' shadowed an outer one, so that the error, when set, was
> > never returned to the caller.
> >
> > Found by LLVM scan-build.
> >
> > Reported-by: Kevin Lo <kevlo at FreeBSD.org>
> > Signed-off-by: Ben Pfaff <blp at nicira.com>
> > ---
> > lib/ofp-parse.c | 2 +-
> > tests/ofproto.at | 5 +++++
> > 2 files changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c
> > index 8fce546..83f06f3 100644
> > --- a/lib/ofp-parse.c
> > +++ b/lib/ofp-parse.c
> > @@ -1333,7 +1333,7 @@ parse_ofp_group_mod_str__(struct ofputil_group_mod *gm, uint16_t command,
> > } else if (!strcmp(value, "last")) {
> > gm->command_bucket_id = OFPG15_BUCKET_LAST;
> > } else {
> > - char *error = str_to_u32(value, &gm->command_bucket_id);
> > + error = str_to_u32(value, &gm->command_bucket_id);
> > if (error) {
> > goto out;
> > }
> > diff --git a/tests/ofproto.at b/tests/ofproto.at
> > index 5ae3139..acab26e 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 test.
> > +AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn insert-buckets br0 group_id=1234,command_bucket_id=0xffffff01,bucket=bucket_id:0,actions=output:0,bucket=bucket_id:1,actions=output:1], [1], [],
> > + [ovs-ofctl: invalid command bucket id 4294967041
> > +])
> > OVS_VSWITCHD_STOP
> > AT_CLEANUP
> >
> > --
> > 2.1.3
> >
> > _______________________________________________
> > dev mailing list
> > dev at openvswitch.org
> > http://openvswitch.org/mailman/listinfo/dev
>
More information about the dev
mailing list