[ovs-dev] [PATCH 2/8] ofproto: Use proper error code when meter_id is out of range.
Jarno Rajahalme
jrajahalme at nicira.com
Sun Sep 8 01:27:08 UTC 2013
Use OUT_OF_METERS when given meter_id is greater than what is supported
by the datapath. Retain the INVALID_METER error code for the meter_ids
outside of the range supported by the specification.
Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
---
ofproto/ofproto.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index fe81310..f413193 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -4627,9 +4627,12 @@ handle_meter_mod(struct ofconn *ofconn, const struct ofp_header *oh)
if (mm.command != OFPMC13_DELETE) {
/* Fails also when meters are not implemented by the provider. */
- if (!meter_id || meter_id > ofproto->meter_features.max_meters) {
+ if (meter_id == 0 || meter_id > OFPM13_MAX) {
error = OFPERR_OFPMMFC_INVALID_METER;
goto exit_free_bands;
+ } else if (meter_id > ofproto->meter_features.max_meters) {
+ error = OFPERR_OFPMMFC_OUT_OF_METERS;
+ goto exit_free_bands;
}
if (mm.meter.n_bands > ofproto->meter_features.max_bands) {
error = OFPERR_OFPMMFC_OUT_OF_BANDS;
--
1.7.10.4
More information about the dev
mailing list