From b2a27ddc46d934849f12e015c0597351659b5d58 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 4 Nov 2013 22:24:28 -0800 Subject: [PATCH] ofp-actions: Allow meter actions in ofpacts_verify(). Signed-off-by: Ben Pfaff Acked-by: Jarno Rajahalme --- lib/ofp-actions.c | 9 +++++---- tests/ofp-print.at | 12 ++++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index bae479ec4..6c90d5ca2 100644 --- a/lib/ofp-actions.c +++ b/lib/ofp-actions.c @@ -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); diff --git a/tests/ofp-print.at b/tests/ofp-print.at index 8701f540b..1cf988019 100644 --- a/tests/ofp-print.at +++ b/tests/ofp-print.at @@ -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 "\ -- 2.47.0