[ovs-dev] [PATCH 20/63] learning-switch: Call ofputil_encode_flow_mod() with correct protocol

Simon Horman horms at verge.net.au
Wed Jun 27 08:19:56 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.

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

---

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 e5f726b..3336165 100644
--- a/lib/learning-switch.c
+++ b/lib/learning-switch.c
@@ -463,6 +463,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",
@@ -511,6 +514,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;
@@ -527,7 +533,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