[ovs-dev] [meter-bugs 4/6] ofp-util: Report OFPMMFC_BAD_BAND for bad band type in meter mod decoding.

Jarno Rajahalme jrajahalme at nicira.com
Tue Nov 5 17:39:18 UTC 2013


Acked-by: Jarno Rajahalme <jrajahalme at nicira.com>

On Nov 4, 2013, at 10:42 PM, Ben Pfaff <blp at nicira.com> wrote:

> Signed-off-by: Ben Pfaff <blp at nicira.com>
> ---
> lib/ofp-util.c     |    3 +++
> tests/ofp-print.at |   10 ++++++++++
> 2 files changed, 13 insertions(+)
> 
> diff --git a/lib/ofp-util.c b/lib/ofp-util.c
> index 9645e04..be632e9 100644
> --- a/lib/ofp-util.c
> +++ b/lib/ofp-util.c
> @@ -1698,6 +1698,9 @@ ofputil_pull_bands(struct ofpbuf *msg, size_t len, uint16_t *n_bands,
>         }
>         mb = ofpbuf_put_uninit(bands, sizeof *mb);
>         mb->type = ntohs(ombh->type);
> +        if (mb->type != OFPMBT13_DROP && mb->type != OFPMBT13_DSCP_REMARK) {
> +            return OFPERR_OFPMMFC_BAD_BAND;
> +        }
>         mb->rate = ntohl(ombh->rate);
>         mb->burst_size = ntohl(ombh->burst_size);
>         mb->prec_level = (mb->type == OFPMBT13_DSCP_REMARK) ?
> diff --git a/tests/ofp-print.at b/tests/ofp-print.at
> index 1cf9880..36dad6a 100644
> --- a/tests/ofp-print.at
> +++ b/tests/ofp-print.at
> @@ -1856,6 +1856,16 @@ type=drop rate=1024 burst_size=128
> ])
> AT_CLEANUP
> 
> +AT_SETUP([OFPT_METER_MOD request - bad band - OF1.3])
> +AT_KEYWORDS([ofp-print])
> +AT_CHECK([ovs-ofctl ofp-print "\
> +04 1d 00 20 85 01 d7 38 00 00 00 00 00 00 00 01
> +00 05 00 10 00 00 00 02 00 00 00 02 00 00 00 00
> +"], [0], [dnl
> +OFPT_METER_MOD (OF1.3) (xid=0x8501d738): ***decode error: OFPMMFC_BAD_BAND***
> +])
> +AT_CLEANUP
> +
> AT_SETUP([OFPST_METER request - OF1.3])
> AT_KEYWORDS([ofp-print OFPT_STATS_REQUEST])
> AT_CHECK([ovs-ofctl ofp-print "041200180000000200090000000000000000000100000000"], [0], [dnl
> -- 
> 1.7.10.4
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev




More information about the dev mailing list