ofp-actions: Allow meter actions in ofpacts_verify().
authorBen Pfaff <blp@nicira.com>
Tue, 5 Nov 2013 06:24:28 +0000 (22:24 -0800)
committerBen Pfaff <blp@nicira.com>
Tue, 5 Nov 2013 17:46:32 +0000 (09:46 -0800)
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
lib/ofp-actions.c
tests/ofp-print.at

index bae479e..6c90d5c 100644 (file)
@@ -2150,14 +2150,15 @@ ofpacts_verify(const struct ofpact ofpacts[], size_t ofpacts_len)
     const struct ofpact *a;
     enum ovs_instruction_type inst;
 
-    inst = OVSINST_OFPIT11_APPLY_ACTIONS;
+    inst = OVSINST_OFPIT13_METER;
     OFPACT_FOR_EACH (a, ofpacts, ofpacts_len) {
         enum ovs_instruction_type next;
 
         next = ovs_instruction_type_from_ofpact_type(a->type);
-        if (inst == OVSINST_OFPIT11_APPLY_ACTIONS
-            ? next < inst
-            : next <= inst) {
+        if (a > ofpacts
+            && (inst == OVSINST_OFPIT11_APPLY_ACTIONS
+                ? next < inst
+                : next <= inst)) {
             const char *name = ovs_instruction_name_from_type(inst);
             const char *next_name = ovs_instruction_name_from_type(next);
 
index 8701f54..1cf9880 100644 (file)
@@ -855,6 +855,18 @@ OFPT_FLOW_MOD (OF1.2) (xid=0x52334507): ADD priority=255,sctp actions=set_field:
 ])
 AT_CLEANUP
 
+dnl This triggered a buggy "instructions out of order" message earlier.
+AT_SETUP([OFPT_FLOW_MOD - OF1.3 - meter])
+AT_KEYWORDS([ofp-print])
+AT_CHECK([ovs-ofctl ofp-print "\
+04 0e 00 40 cf fe 6b 86 00 00 00 00 00 00 00 00 \
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 e8 \
+ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00 \
+00 01 00 04 00 00 00 00 00 06 00 08 00 00 00 01"], [0], [dnl
+OFPT_FLOW_MOD (OF1.3) (xid=0xcffe6b86): ADD priority=1000 actions=meter:1
+])
+AT_CLEANUP
+
 AT_SETUP([OFPT_FLOW reply - OF1.2 - set-field ip_src])
 AT_KEYWORDS([ofp-print])
 AT_CHECK([ovs-ofctl '-vPATTERN:console:%c|%p|%m' ofp-print "\