[ovs-dev] [PATCH] ofproto: Report correct error for emergency flow with timeout.

Ben Pfaff blp at nicira.com
Thu Nov 1 07:22:41 UTC 2012


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 <blp at nicira.com>
---
 ofproto/ofproto.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 2fb2fc8..444717e 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -3302,9 +3302,13 @@ handle_flow_mod(struct ofconn *ofconn, const struct ofp_header *oh)
     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. */
-        error = 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. */
+        error = (fm.hard_timeout || fm.idle_timeout
+                 ? OFPERR_OFPFMFC_BAD_EMERG_TIMEOUT
+                 : OFPERR_OFPFMFC_TABLE_FULL);
     }
     if (!error) {
         error = ofpacts_check(fm.ofpacts, fm.ofpacts_len,
-- 
1.7.10.4




More information about the dev mailing list