[ovs-dev] [PATCH/RFC] connmgr: Do not use OFPRR_METER_DELETE before OF1.4

Simon Horman horms at verge.net.au
Fri May 30 08:14:47 UTC 2014


OFPRR_METER_DELETE was introduced in OF1.4 however meters were introduced
in OF1.3.

Regardless of the OF version when flows are deleted cause flows to be
deleted handle_delete_meter() calls delete_flows__() with
OFPRR_METER_DELETE as the reason.

In order to avoid sending OFPRR_METER_DELETE to controllers connected
using OF1.3 map OFPRR_METER_DELETE to OFPRR_DELETE which exists in that
version.

Signed-off-by: Simon Horman <horms at verge.net.au>

---
It is not clear to me how to test this change
---
 ofproto/connmgr.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c
index e0a097f..8f37e41 100644
--- a/ofproto/connmgr.c
+++ b/ofproto/connmgr.c
@@ -1685,7 +1685,15 @@ connmgr_send_flow_removed(struct connmgr *mgr,
     struct ofconn *ofconn;
 
     LIST_FOR_EACH (ofconn, node, &mgr->all_conns) {
-        if (ofconn_receives_async_msg(ofconn, OAM_FLOW_REMOVED, fr->reason)) {
+        /* OFPRR_METER_DELETE does not exist in OF1.3 but meters do,
+         * so that reason may appear here. Map it to OFPRR_DELETE */
+        unsigned int reason = fr->reason;
+        if (reason == OFPRR_METER_DELETE &&
+            !(ofconn_get_protocol(ofconn) & OFPUTIL_P_OF14_UP)) {
+            reason = OFPRR_METER_DELETE;
+        }
+
+        if (ofconn_receives_async_msg(ofconn, OAM_FLOW_REMOVED, reason)) {
             struct ofpbuf *msg;
 
             /* Account flow expirations as replies to OpenFlow requests.  That
-- 
1.8.5.2




More information about the dev mailing list