[ovs-dev] [PATCH 43/45] Local: learning-switch: Call ofputil_encode_flow_mod() with correct protocol

Simon Horman horms at verge.net.au
Mon Jul 30 02:03:41 UTC 2012


Empirically it appears that process_packet_in() should call
ofputil_encode_flow_mod() with protocol as defived from rconn
rather than sw->protocol.

**** This is a local hack and should not be applied ****

---

v8
* No change

v7
* No change

v6
* No change

v5
* Actually retrieve protocol from rconn.
  This patch was dependent on a subsequent patch.

v4
* No change

v3
* Initial post
---
 lib/learning-switch.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/learning-switch.c b/lib/learning-switch.c
index 2e29b74..f8cad85 100644
--- a/lib/learning-switch.c
+++ b/lib/learning-switch.c
@@ -457,6 +457,9 @@ process_packet_in(struct lswitch *sw, struct rconn *rconn,
     struct ofpbuf pkt;
     struct flow flow;
 
+    enum ofputil_protocol protocol;
+    int ofp_version;
+
     error = ofputil_decode_packet_in(&pi, oh);
     if (error) {
         VLOG_WARN_RL(&rl, "failed to decode packet-in: %s",
@@ -505,6 +508,9 @@ process_packet_in(struct lswitch *sw, struct rconn *rconn,
     po.ofpacts = ofpacts.data;
     po.ofpacts_len = ofpacts.size;
 
+    ofp_version = rconn_get_version(rconn);
+    protocol = ofputil_protocol_from_ofp_version(ofp_version);
+
     /* Send the packet, and possibly the whole flow, to the output port. */
     if (sw->max_idle >= 0 && (!sw->ml || out_port != OFPP_FLOOD)) {
         struct ofputil_flow_mod fm;
@@ -521,7 +527,7 @@ process_packet_in(struct lswitch *sw, struct rconn *rconn,
         fm.out_port = OFPP_NONE;
         fm.ofpacts = ofpacts.data;
         fm.ofpacts_len = ofpacts.size;
-        buffer = ofputil_encode_flow_mod(&fm, sw->protocol);
+        buffer = ofputil_encode_flow_mod(&fm, protocol);
 
         queue_tx(sw, rconn, buffer);
 
-- 
1.7.10.2.484.gcd07cc5




More information about the dev mailing list