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 <ho...@verge.net.au>

---

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 887a365..db048e2 100644
--- a/lib/learning-switch.c
+++ b/lib/learning-switch.c
@@ -454,6 +454,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",
@@ -502,6 +505,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;
@@ -518,7 +524,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

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to