[ovs-dev] [PATCH 09/47] learning-switch: Send Features Request and Set Config with correct version

Simon Horman horms at verge.net.au
Wed Aug 1 07:01:52 UTC 2012


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

---

v9
* No change

v8
* No change

v7
* No change

v6
* Initial post
---
 lib/learning-switch.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/learning-switch.c b/lib/learning-switch.c
index 887a365..b7a435c 100644
--- a/lib/learning-switch.c
+++ b/lib/learning-switch.c
@@ -318,14 +318,17 @@ send_features_request(struct lswitch *sw, struct rconn *rconn)
     if (now >= sw->last_features_request + 1) {
         struct ofpbuf *b;
         struct ofp_switch_config *osc;
+        int ofp_version = rconn_get_version(rconn);
+
+        assert(ofp_version > 0 && ofp_version < 0xff);
 
         /* Send OFPT_FEATURES_REQUEST. */
-        b = ofpraw_alloc(OFPRAW_OFPT_FEATURES_REQUEST, OFP10_VERSION, 0);
+        b = ofpraw_alloc(OFPRAW_OFPT_FEATURES_REQUEST, ofp_version, 0);
         queue_tx(sw, rconn, b);
 
         /* Send OFPT_SET_CONFIG. */
-        b = ofpraw_alloc(OFPRAW_OFPT_SET_CONFIG, OFP10_VERSION, sizeof *osc);
-        osc = ofpbuf_put_uninit(b, sizeof *osc);
+        b = ofpraw_alloc(OFPRAW_OFPT_SET_CONFIG, ofp_version, sizeof *osc);
+        osc = ofpbuf_put_zeros(b, sizeof *osc);
         osc->miss_send_len = htons(OFP_DEFAULT_MISS_SEND_LEN);
         queue_tx(sw, rconn, b);
 
-- 
1.7.10.2.484.gcd07cc5




More information about the dev mailing list