Signed-off-by: Ben Pfaff <[email protected]>
---
lib/ofp-util.c | 5 +++++
tests/ofp-print.at | 9 +++++++++
2 files changed, 14 insertions(+)
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index be632e9..16b09f6 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -1731,6 +1731,11 @@ ofputil_decode_meter_mod(const struct ofp_header *oh,
/* Translate the message. */
mm->command = ntohs(omm->command);
+ if (mm->command != OFPMC13_ADD &&
+ mm->command != OFPMC13_MODIFY &&
+ mm->command != OFPMC13_DELETE) {
+ return OFPERR_OFPMMFC_BAD_COMMAND;
+ }
mm->meter.meter_id = ntohl(omm->meter_id);
if (mm->command == OFPMC13_DELETE) {
diff --git a/tests/ofp-print.at b/tests/ofp-print.at
index 36dad6a..9d01be3 100644
--- a/tests/ofp-print.at
+++ b/tests/ofp-print.at
@@ -1866,6 +1866,15 @@ OFPT_METER_MOD (OF1.3) (xid=0x8501d738): ***decode
error: OFPMMFC_BAD_BAND***
])
AT_CLEANUP
+AT_SETUP([OFPT_METER_MOD request - bad command - OF1.3])
+AT_KEYWORDS([ofp-print])
+AT_CHECK([ovs-ofctl ofp-print "\
+04 1d 00 10 28 a6 26 52 00 08 00 00 00 00 00 01
+"], [0], [dnl
+OFPT_METER_MOD (OF1.3) (xid=0x28a62652): ***decode error:
OFPMMFC_BAD_COMMAND***
+])
+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
[email protected]
http://openvswitch.org/mailman/listinfo/dev