From b5bf17dd74a4378a86985b12d055ce2a61498140 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 1 Nov 2012 00:22:41 -0700 Subject: [PATCH] ofproto: Report correct error for emergency flow with timeout. The OpenFlow 1.0 specification says: Emergency flow mod messages must have timeout values set to zero. Otherwise, the switch must refuse the addition and respond with an ofp_error_msg with OFPET_FLOW_MOD_FAILED type and OFPFMFC_BAD_EMERG_TIMEOUT code. but Open vSwitch reported OFPFMFC_TABLE_FULL in this case. This commit fixes the problem. Fixes detailed_contr_sw_messages.EmerFlowTimeout failure in OFTest. Signed-off-by: Ben Pfaff Acked-by: Kyle Mestery --- lib/ofp-util.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/ofp-util.c b/lib/ofp-util.c index 11b6192e0..d5333eeaa 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -1590,11 +1590,13 @@ ofputil_decode_flow_mod(struct ofputil_flow_mod *fm, if (fm->flags & OFPFF10_EMERG) { /* We do not support the OpenFlow 1.0 emergency flow cache, which * is not required in OpenFlow 1.0.1 and removed from OpenFlow 1.1. - * There is no good error code, so just state that the flow table - * is full. - * Moreover, OFPFF10_EMERG overlaps with OFPFF12_RESET_COUNTS, - * so this check must be here */ - return OFPERR_OFPFMFC_TABLE_FULL; + * + * OpenFlow 1.0 specifies the error code to use when idle_timeout + * or hard_timeout is nonzero. Otherwise, there is no good error + * code, so just state that the flow table is full. */ + return (fm->hard_timeout || fm->idle_timeout + ? OFPERR_OFPFMFC_BAD_EMERG_TIMEOUT + : OFPERR_OFPFMFC_TABLE_FULL); } if (protocol & OFPUTIL_P_TID) { -- 2.43.0