[ovs-dev] [of1.1 04/11] Begin breaking openflow-1.0.h into common and version-specific definitions.

Ben Pfaff blp at nicira.com
Thu Feb 16 00:37:47 UTC 2012


The intention is that, as each OpenFlow 1.1 feature is added to Open
vSwitch, the corresponding protocol definitions will be broken up this way:

  - Definitions that are the same in OF1.0 and OF1.1 will retain the "OFP"
    or "ofp" prefix and move to openflow-common.h.

  - Definitions that are specific to OF1.0 will be renamed with an "OFP10"
    or "ofp10" prefix and stay in openflow-1.0.h.

  - Definitions that are specific to OF1.1 will be renamed with an "OFP11"
    or "ofp11" prefix and move to openflow-1.1.h.

This commit starts this process with some basic OpenFlow definitions.
---
 include/openflow/automake.mk       |   12 ++++-
 include/openflow/openflow-1.0.h    |   34 +-------------
 include/openflow/openflow-1.1.h    |   59 +++++++++++++++++++++++++
 include/openflow/openflow-common.h |   85 ++++++++++++++++++++++++++++++++++++
 include/openflow/openflow.h        |    1 +
 lib/ofp-util.c                     |   12 +++---
 lib/rconn.c                        |    2 +-
 lib/stream.c                       |    2 +-
 lib/vconn.c                        |   12 +++---
 ofproto/connmgr.c                  |    4 +-
 tests/test-vconn.c                 |   20 ++++----
 utilities/ovs-controller.c         |    6 +-
 utilities/ovs-ofctl.c              |    6 +-
 vswitchd/ovs-vswitchd.c            |    2 +-
 14 files changed, 189 insertions(+), 68 deletions(-)
 create mode 100644 include/openflow/openflow-1.1.h
 create mode 100644 include/openflow/openflow-common.h

diff --git a/include/openflow/automake.mk b/include/openflow/automake.mk
index 70cd520..f037a2b 100644
--- a/include/openflow/automake.mk
+++ b/include/openflow/automake.mk
@@ -1,6 +1,8 @@
 noinst_HEADERS += \
 	include/openflow/nicira-ext.h \
 	include/openflow/openflow-1.0.h \
+	include/openflow/openflow-1.1.h \
+	include/openflow/openflow-common.h \
 	include/openflow/openflow.h
 
 if HAVE_PYTHON
@@ -11,15 +13,19 @@ SUFFIXES += .h .hstamp
 	touch $@
 
 HSTAMP_FILES = \
-	include/openflow/openflow.hstamp \
+	include/openflow/nicira.hstamp \
 	include/openflow/openflow-1.0.hstamp \
-	include/openflow/nicira.hstamp
+	include/openflow/openflow-1.1.hstamp \
+	include/openflow/openflow.hstamp
 ALL_LOCAL += $(HSTAMP_FILES)
 $(HSTAMP_FILES): build-aux/check-structs
 
-include/openflow/openflow-1.0.hstamp: include/openflow/openflow.h
+include/openflow/openflow-1.0.hstamp: include/openflow/openflow-common.h
+include/openflow/openflow-1.1.hstamp: include/openflow/openflow-common.h
 include/openflow/nicira-ext.hstamp: \
 	include/openflow/openflow-1.0.h \
+	include/openflow/openflow-1.1.h \
+	include/openflow/openflow-common.h \
 	include/openflow/openflow.h
 endif
 
diff --git a/include/openflow/openflow-1.0.h b/include/openflow/openflow-1.0.h
index 3b1a3f0..111c67a 100644
--- a/include/openflow/openflow-1.0.h
+++ b/include/openflow/openflow-1.0.h
@@ -19,37 +19,7 @@
 #ifndef OPENFLOW_OPENFLOW10_H
 #define OPENFLOW_OPENFLOW10_H 1
 
-#include "openvswitch/types.h"
-
-#ifdef SWIG
-#define OFP_ASSERT(EXPR)        /* SWIG can't handle OFP_ASSERT. */
-#elif !defined(__cplusplus)
-/* Build-time assertion for use in a declaration context. */
-#define OFP_ASSERT(EXPR)                                                \
-        extern int (*build_assert(void))[ sizeof(struct {               \
-                    unsigned int build_assert_failed : (EXPR) ? 1 : -1; })]
-#else /* __cplusplus */
-#include <boost/static_assert.hpp>
-#define OFP_ASSERT BOOST_STATIC_ASSERT
-#endif /* __cplusplus */
-
-/* Version number:
- * Non-experimental versions released: 0x01
- * Experimental versions released: 0x81 -- 0x99
- */
-/* The most significant bit being set in the version field indicates an
- * experimental OpenFlow version.
- */
-#define OFP_VERSION   0x01
-#define OFP10_VERSION 0x01
-
-#define OFP_MAX_TABLE_NAME_LEN 32
-#define OFP_MAX_PORT_NAME_LEN  16
-
-#define OFP_TCP_PORT  6633
-#define OFP_SSL_PORT  6633
-
-#define OFP_ETH_ALEN 6          /* Bytes in an Ethernet address. */
+#include "openflow/openflow-common.h"
 
 /* Port numbering.  Physical ports are numbered starting from 1. */
 enum ofp_port {
@@ -113,7 +83,7 @@ enum ofp_type {
 
 /* Header on all OpenFlow packets. */
 struct ofp_header {
-    uint8_t version;    /* OFP_VERSION. */
+    uint8_t version;    /* An OpenFlow version number, e.g. OFP10_VERSION. */
     uint8_t type;       /* One of the OFPT_ constants. */
     ovs_be16 length;    /* Length including this ofp_header. */
     ovs_be32 xid;       /* Transaction id associated with this packet.
diff --git a/include/openflow/openflow-1.1.h b/include/openflow/openflow-1.1.h
new file mode 100644
index 0000000..8b407e3
--- /dev/null
+++ b/include/openflow/openflow-1.1.h
@@ -0,0 +1,59 @@
+/* Copyright (c) 2008, 2011 The Board of Trustees of The Leland Stanford
+ * Junior University
+ *
+ * We are making the OpenFlow specification and associated documentation
+ * (Software) available for public use and benefit with the expectation
+ * that others will use, modify and enhance the Software and contribute
+ * those enhancements back to the community. However, since we would
+ * like to make the Software available for broadest use, with as few
+ * restrictions as possible permission is hereby granted, free of
+ * charge, to any person obtaining a copy of this Software to deal in
+ * the Software under the copyrights without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * The name and trademarks of copyright holder(s) may NOT be used in
+ * advertising or publicity pertaining to the Software or any
+ * derivatives without specific, written prior permission.
+ */
+
+/*
+ * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* OpenFlow: protocol between controller and datapath. */
+
+#ifndef OPENFLOW_11_H
+#define OPENFLOW_11_H 1
+
+#include "openflow/openflow-common.h"
+
+/* Nothing here yet. */
+
+#endif /* openflow/openflow-1.1.h */
diff --git a/include/openflow/openflow-common.h b/include/openflow/openflow-common.h
new file mode 100644
index 0000000..9163efd
--- /dev/null
+++ b/include/openflow/openflow-common.h
@@ -0,0 +1,85 @@
+/* Copyright (c) 2008, 2011 The Board of Trustees of The Leland Stanford
+ * Junior University
+ *
+ * We are making the OpenFlow specification and associated documentation
+ * (Software) available for public use and benefit with the expectation
+ * that others will use, modify and enhance the Software and contribute
+ * those enhancements back to the community. However, since we would
+ * like to make the Software available for broadest use, with as few
+ * restrictions as possible permission is hereby granted, free of
+ * charge, to any person obtaining a copy of this Software to deal in
+ * the Software under the copyrights without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * The name and trademarks of copyright holder(s) may NOT be used in
+ * advertising or publicity pertaining to the Software or any
+ * derivatives without specific, written prior permission.
+ */
+
+/*
+ * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OPENFLOW_COMMON_H
+#define OPENFLOW_COMMON_H 1
+
+#include "openvswitch/types.h"
+
+#ifdef SWIG
+#define OFP_ASSERT(EXPR)        /* SWIG can't handle OFP_ASSERT. */
+#elif !defined(__cplusplus)
+/* Build-time assertion for use in a declaration context. */
+#define OFP_ASSERT(EXPR)                                                \
+        extern int (*build_assert(void))[ sizeof(struct {               \
+                    unsigned int build_assert_failed : (EXPR) ? 1 : -1; })]
+#else /* __cplusplus */
+#include <boost/static_assert.hpp>
+#define OFP_ASSERT BOOST_STATIC_ASSERT
+#endif /* __cplusplus */
+
+/* Version number:
+ * Non-experimental versions released: 0x01 0x02
+ * Experimental versions released: 0x81 -- 0x99
+ */
+/* The most significant bit being set in the version field indicates an
+ * experimental OpenFlow version.
+ */
+#define OFP10_VERSION   0x01
+#define OFP11_VERSION   0x02
+
+#define OFP_MAX_TABLE_NAME_LEN 32
+#define OFP_MAX_PORT_NAME_LEN  16
+
+#define OFP_TCP_PORT  6633
+#define OFP_SSL_PORT  6633
+
+#define OFP_ETH_ALEN 6          /* Bytes in an Ethernet address. */
+
+#endif /* openflow/openflow-common.h */
diff --git a/include/openflow/openflow.h b/include/openflow/openflow.h
index 1c02da3..769a0ad 100644
--- a/include/openflow/openflow.h
+++ b/include/openflow/openflow.h
@@ -18,5 +18,6 @@
 #define OPENFLOW_OPENFLOW_H 1
 
 #include "openflow/openflow-1.0.h"
+#include "openflow/openflow-1.1.h"
 
 #endif /* openflow/openflow.h */
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 7ae933f..100386c 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -865,7 +865,7 @@ enum ofputil_protocol
 ofputil_protocol_from_ofp_version(int version)
 {
     switch (version) {
-    case OFP_VERSION: return OFPUTIL_P_OF10;
+    case OFP10_VERSION: return OFPUTIL_P_OF10;
     default: return 0;
     }
 }
@@ -2090,7 +2090,7 @@ ofputil_encode_packet_in(const struct ofputil_packet_in *pin,
 
         packet = ofpbuf_new(send_len + header_len);
         opi = ofpbuf_put_zeros(packet, header_len);
-        opi->header.version = OFP_VERSION;
+        opi->header.version = OFP10_VERSION;
         opi->header.type = OFPT_PACKET_IN;
         opi->total_len = htons(pin->total_len);
         opi->in_port = htons(pin->fmd.in_port);
@@ -2127,7 +2127,7 @@ ofputil_encode_packet_in(const struct ofputil_packet_in *pin,
         ofpbuf_put(packet, pin->packet, send_len);
 
         npi = packet->data;
-        npi->nxh.header.version = OFP_VERSION;
+        npi->nxh.header.version = OFP10_VERSION;
         npi->nxh.header.type = OFPT_VENDOR;
         npi->nxh.vendor = htonl(NX_VENDOR_ID);
         npi->nxh.subtype = htonl(NXT_PACKET_IN);
@@ -2313,7 +2313,7 @@ put_openflow_xid(size_t openflow_len, uint8_t type, ovs_be32 xid,
     assert(openflow_len <= UINT16_MAX);
 
     oh = ofpbuf_put_uninit(buffer, openflow_len);
-    oh->version = OFP_VERSION;
+    oh->version = OFP10_VERSION;
     oh->type = type;
     oh->length = htons(openflow_len);
     oh->xid = xid;
@@ -2518,7 +2518,7 @@ make_flow_mod(uint16_t command, const struct cls_rule *rule,
     size_t size = sizeof *ofm + actions_len;
     struct ofpbuf *out = ofpbuf_new(size);
     ofm = ofpbuf_put_zeros(out, sizeof *ofm);
-    ofm->header.version = OFP_VERSION;
+    ofm->header.version = OFP10_VERSION;
     ofm->header.type = OFPT_FLOW_MOD;
     ofm->header.length = htons(size);
     ofm->cookie = 0;
@@ -2595,7 +2595,7 @@ make_echo_request(void)
     struct ofp_header *rq;
     struct ofpbuf *out = ofpbuf_new(sizeof *rq);
     rq = ofpbuf_put_uninit(out, sizeof *rq);
-    rq->version = OFP_VERSION;
+    rq->version = OFP10_VERSION;
     rq->type = OFPT_ECHO_REQUEST;
     rq->length = htons(sizeof *rq);
     rq->xid = htonl(0);
diff --git a/lib/rconn.c b/lib/rconn.c
index 072e1ad..f6d85a7 100644
--- a/lib/rconn.c
+++ b/lib/rconn.c
@@ -335,7 +335,7 @@ reconnect(struct rconn *rc)
         VLOG_INFO("%s: connecting...", rc->name);
     }
     rc->n_attempted_connections++;
-    retval = vconn_open(rc->target, OFP_VERSION, &rc->vconn);
+    retval = vconn_open(rc->target, OFP10_VERSION, &rc->vconn);
     if (!retval) {
         rc->remote_ip = vconn_get_remote_ip(rc->vconn);
         rc->local_ip = vconn_get_local_ip(rc->vconn);
diff --git a/lib/stream.c b/lib/stream.c
index 4c3583c..066de4e 100644
--- a/lib/stream.c
+++ b/lib/stream.c
@@ -757,7 +757,7 @@ stream_guess_content(const uint8_t *data, ssize_t size)
             return STREAM_SSL;
         case PAIR('{', '"'):
             return STREAM_JSONRPC;
-        case PAIR(OFP_VERSION, OFPT_HELLO):
+        case PAIR(OFP10_VERSION, OFPT_HELLO):
             return STREAM_OPENFLOW;
         }
     }
diff --git a/lib/vconn.c b/lib/vconn.c
index 93d6388..f0be46a 100644
--- a/lib/vconn.c
+++ b/lib/vconn.c
@@ -213,7 +213,7 @@ vconn_verify_name(const char *name)
  *
  * The vconn will automatically negotiate an OpenFlow protocol version
  * acceptable to both peers on the connection.  The version negotiated will be
- * no lower than 'min_version' and no higher than OFP_VERSION.
+ * no lower than 'min_version' and no higher than OFP10_VERSION.
  *
  * Returns 0 if successful, otherwise a positive errno value.  If successful,
  * stores a pointer to the new connection in '*vconnp', otherwise a null
@@ -415,13 +415,13 @@ vcs_recv_hello(struct vconn *vconn)
                 ds_destroy(&msg);
             }
 
-            vconn->version = MIN(OFP_VERSION, oh->version);
+            vconn->version = MIN(OFP10_VERSION, oh->version);
             if (vconn->version < vconn->min_version) {
                 VLOG_WARN_RL(&bad_ofmsg_rl,
                              "%s: version negotiation failed: we support "
                              "versions 0x%02x to 0x%02x inclusive but peer "
                              "supports no later than version 0x%02"PRIx8,
-                             vconn->name, vconn->min_version, OFP_VERSION,
+                             vconn->name, vconn->min_version, OFP10_VERSION,
                              oh->version);
                 vconn->state = VCS_SEND_ERROR;
             } else {
@@ -429,7 +429,7 @@ vcs_recv_hello(struct vconn *vconn)
                          "(we support versions 0x%02x to 0x%02x inclusive, "
                          "peer no later than version 0x%02"PRIx8")",
                          vconn->name, vconn->version, vconn->min_version,
-                         OFP_VERSION, oh->version);
+                         OFP10_VERSION, oh->version);
                 vconn->state = VCS_CONNECTED;
             }
             ofpbuf_delete(b);
@@ -460,7 +460,7 @@ vcs_send_error(struct vconn *vconn)
 
     snprintf(s, sizeof s, "We support versions 0x%02x to 0x%02x inclusive but "
              "you support no later than version 0x%02"PRIx8".",
-             vconn->min_version, OFP_VERSION, vconn->version);
+             vconn->min_version, OFP10_VERSION, vconn->version);
     b = ofperr_encode_hello(OFPERR_OFPHFC_INCOMPATIBLE,
                             ofperr_domain_from_version(vconn->version), s);
     retval = do_send(vconn, b);
@@ -956,7 +956,7 @@ pvconn_close(struct pvconn *pvconn)
  *
  * The new vconn will automatically negotiate an OpenFlow protocol version
  * acceptable to both peers on the connection.  The version negotiated will be
- * no lower than 'min_version' and no higher than OFP_VERSION.
+ * no lower than 'min_version' and no higher than OFP10_VERSION.
  *
  * pvconn_accept() will not block waiting for a connection.  If no connection
  * is ready to be accepted, it returns EAGAIN immediately. */
diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c
index 72e80f1..7a7c789 100644
--- a/ofproto/connmgr.c
+++ b/ofproto/connmgr.c
@@ -274,7 +274,7 @@ connmgr_run(struct connmgr *mgr,
         struct vconn *vconn;
         int retval;
 
-        retval = pvconn_accept(ofservice->pvconn, OFP_VERSION, &vconn);
+        retval = pvconn_accept(ofservice->pvconn, OFP10_VERSION, &vconn);
         if (!retval) {
             struct rconn *rconn;
             char *name;
@@ -297,7 +297,7 @@ connmgr_run(struct connmgr *mgr,
         struct vconn *vconn;
         int retval;
 
-        retval = pvconn_accept(mgr->snoops[i], OFP_VERSION, &vconn);
+        retval = pvconn_accept(mgr->snoops[i], OFP10_VERSION, &vconn);
         if (!retval) {
             add_snooper(mgr, vconn);
         } else if (retval != EAGAIN) {
diff --git a/tests/test-vconn.c b/tests/test-vconn.c
index 42940c3..8dfc1e4 100644
--- a/tests/test-vconn.c
+++ b/tests/test-vconn.c
@@ -147,7 +147,7 @@ test_refuse_connection(int argc OVS_UNUSED, char *argv[])
                       : EPROTO);
 
     fpv_create(type, &fpv);
-    CHECK_ERRNO(vconn_open(fpv.vconn_name, OFP_VERSION, &vconn), 0);
+    CHECK_ERRNO(vconn_open(fpv.vconn_name, OFP10_VERSION, &vconn), 0);
     fpv_close(&fpv);
     vconn_run(vconn);
     CHECK_ERRNO(vconn_connect(vconn), expected_error);
@@ -171,7 +171,7 @@ test_accept_then_close(int argc OVS_UNUSED, char *argv[])
                       : EPROTO);
 
     fpv_create(type, &fpv);
-    CHECK_ERRNO(vconn_open(fpv.vconn_name, OFP_VERSION, &vconn), 0);
+    CHECK_ERRNO(vconn_open(fpv.vconn_name, OFP10_VERSION, &vconn), 0);
     vconn_run(vconn);
     stream_close(fpv_accept(&fpv));
     fpv_close(&fpv);
@@ -192,7 +192,7 @@ test_read_hello(int argc OVS_UNUSED, char *argv[])
     struct stream *stream;
 
     fpv_create(type, &fpv);
-    CHECK_ERRNO(vconn_open(fpv.vconn_name, OFP_VERSION, &vconn), 0);
+    CHECK_ERRNO(vconn_open(fpv.vconn_name, OFP10_VERSION, &vconn), 0);
     vconn_run(vconn);
     stream = fpv_accept(&fpv);
     fpv_destroy(&fpv);
@@ -202,7 +202,7 @@ test_read_hello(int argc OVS_UNUSED, char *argv[])
 
        retval = stream_recv(stream, &hello, sizeof hello);
        if (retval == sizeof hello) {
-           CHECK(hello.version, OFP_VERSION);
+           CHECK(hello.version, OFP10_VERSION);
            CHECK(hello.type, OFPT_HELLO);
            CHECK(ntohs(hello.length), sizeof hello);
            break;
@@ -238,7 +238,7 @@ test_send_hello(const char *type, const void *out, size_t out_size,
     size_t n_sent;
 
     fpv_create(type, &fpv);
-    CHECK_ERRNO(vconn_open(fpv.vconn_name, OFP_VERSION, &vconn), 0);
+    CHECK_ERRNO(vconn_open(fpv.vconn_name, OFP10_VERSION, &vconn), 0);
     vconn_run(vconn);
     stream = fpv_accept(&fpv);
     fpv_destroy(&fpv);
@@ -268,7 +268,7 @@ test_send_hello(const char *type, const void *out, size_t out_size,
            struct ofp_header hello;
            int retval = stream_recv(stream, &hello, sizeof hello);
            if (retval == sizeof hello) {
-               CHECK(hello.version, OFP_VERSION);
+               CHECK(hello.version, OFP10_VERSION);
                CHECK(hello.type, OFPT_HELLO);
                CHECK(ntohs(hello.length), sizeof hello);
                read_hello = true;
@@ -318,7 +318,7 @@ test_send_plain_hello(int argc OVS_UNUSED, char *argv[])
     const char *type = argv[1];
     struct ofp_header hello;
 
-    hello.version = OFP_VERSION;
+    hello.version = OFP10_VERSION;
     hello.type = OFPT_HELLO;
     hello.length = htons(sizeof hello);
     hello.xid = htonl(0x12345678);
@@ -335,7 +335,7 @@ test_send_long_hello(int argc OVS_UNUSED, char *argv[])
     struct ofp_header hello;
     char buffer[sizeof hello * 2];
 
-    hello.version = OFP_VERSION;
+    hello.version = OFP10_VERSION;
     hello.type = OFPT_HELLO;
     hello.length = htons(sizeof buffer);
     hello.xid = htonl(0x12345678);
@@ -352,7 +352,7 @@ test_send_echo_hello(int argc OVS_UNUSED, char *argv[])
     const char *type = argv[1];
     struct ofp_header echo;
 
-    echo.version = OFP_VERSION;
+    echo.version = OFP10_VERSION;
     echo.type = OFPT_ECHO_REQUEST;
     echo.length = htons(sizeof echo);
     echo.xid = htonl(0x89abcdef);
@@ -379,7 +379,7 @@ test_send_invalid_version_hello(int argc OVS_UNUSED, char *argv[])
     const char *type = argv[1];
     struct ofp_header hello;
 
-    hello.version = OFP_VERSION - 1;
+    hello.version = OFP10_VERSION - 1;
     hello.type = OFPT_HELLO;
     hello.length = htons(sizeof hello);
     hello.xid = htonl(0x12345678);
diff --git a/utilities/ovs-controller.c b/utilities/ovs-controller.c
index 25deaff..da9b17d 100644
--- a/utilities/ovs-controller.c
+++ b/utilities/ovs-controller.c
@@ -115,7 +115,7 @@ main(int argc, char *argv[])
         const char *name = argv[i];
         struct vconn *vconn;
 
-        retval = vconn_open(name, OFP_VERSION, &vconn);
+        retval = vconn_open(name, OFP10_VERSION, &vconn);
         if (!retval) {
             if (n_switches >= MAX_SWITCHES) {
                 ovs_fatal(0, "max %d switch connections", n_switches);
@@ -156,7 +156,7 @@ main(int argc, char *argv[])
         for (i = 0; i < n_listeners && n_switches < MAX_SWITCHES; ) {
             struct vconn *new_vconn;
 
-            retval = pvconn_accept(listeners[i], OFP_VERSION, &new_vconn);
+            retval = pvconn_accept(listeners[i], OFP10_VERSION, &new_vconn);
             if (!retval || retval == EAGAIN) {
                 if (!retval) {
                     new_switch(&switches[n_switches++], new_vconn);
@@ -376,7 +376,7 @@ parse_options(int argc, char *argv[])
             usage();
 
         case 'V':
-            ovs_print_version(OFP_VERSION, OFP_VERSION);
+            ovs_print_version(OFP10_VERSION, OFP10_VERSION);
             exit(EXIT_SUCCESS);
 
         VLOG_OPTION_HANDLERS
diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
index ebdcd49..7f1b5c5 100644
--- a/utilities/ovs-ofctl.c
+++ b/utilities/ovs-ofctl.c
@@ -162,7 +162,7 @@ parse_options(int argc, char *argv[])
             usage();
 
         case 'V':
-            ovs_print_version(OFP_VERSION, OFP_VERSION);
+            ovs_print_version(OFP10_VERSION, OFP10_VERSION);
             exit(EXIT_SUCCESS);
 
         case OPT_STRICT:
@@ -266,7 +266,7 @@ open_vconn_socket(const char *name, struct vconn **vconnp)
 {
     char *vconn_name = xasprintf("unix:%s", name);
     VLOG_DBG("connecting to %s", vconn_name);
-    run(vconn_open_block(vconn_name, OFP_VERSION, vconnp),
+    run(vconn_open_block(vconn_name, OFP10_VERSION, vconnp),
         "connecting to %s", vconn_name);
     free(vconn_name);
 }
@@ -290,7 +290,7 @@ open_vconn__(const char *name, const char *default_suffix,
     free(datapath_type);
 
     if (strchr(name, ':')) {
-        run(vconn_open_block(name, OFP_VERSION, vconnp),
+        run(vconn_open_block(name, OFP10_VERSION, vconnp),
             "connecting to %s", name);
     } else if (!stat(name, &s) && S_ISSOCK(s.st_mode)) {
         open_vconn_socket(name, vconnp);
diff --git a/vswitchd/ovs-vswitchd.c b/vswitchd/ovs-vswitchd.c
index 2360086..3cfa8cf 100644
--- a/vswitchd/ovs-vswitchd.c
+++ b/vswitchd/ovs-vswitchd.c
@@ -159,7 +159,7 @@ parse_options(int argc, char *argv[], char **unixctl_pathp)
             usage();
 
         case 'V':
-            ovs_print_version(OFP_VERSION, OFP_VERSION);
+            ovs_print_version(OFP10_VERSION, OFP10_VERSION);
             exit(EXIT_SUCCESS);
 
         case OPT_MLOCKALL:
-- 
1.7.2.5




More information about the dev mailing list