It's documented to return -1 if the version isn't yet known, but in fact
it returned 0.

Signed-off-by: Ben Pfaff <b...@nicira.com>
---
 lib/vconn.c |    4 ++--
 lib/vconn.h |    3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/vconn.c b/lib/vconn.c
index eb848ba..8b53b06 100644
--- a/lib/vconn.c
+++ b/lib/vconn.c
@@ -368,10 +368,10 @@ vconn_get_local_port(const struct vconn *vconn)
  *
  * A vconn that has successfully connected (that is, vconn_connect() or
  * vconn_send() or vconn_recv() has returned 0) always negotiated a version. */
-enum ofp_version
+int
 vconn_get_version(const struct vconn *vconn)
 {
-    return vconn->version;
+    return vconn->version ? vconn->version : -1;
 }
 
 static void
diff --git a/lib/vconn.h b/lib/vconn.h
index 3bb4450..1a0bc60 100644
--- a/lib/vconn.h
+++ b/lib/vconn.h
@@ -19,6 +19,7 @@
 
 #include <stdbool.h>
 #include "openvswitch/types.h"
+#include "openflow/openflow.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -41,7 +42,7 @@ ovs_be32 vconn_get_remote_ip(const struct vconn *);
 ovs_be16 vconn_get_remote_port(const struct vconn *);
 ovs_be32 vconn_get_local_ip(const struct vconn *);
 ovs_be16 vconn_get_local_port(const struct vconn *);
-enum ofp_version vconn_get_version(const struct vconn *);
+int vconn_get_version(const struct vconn *);
 int vconn_connect(struct vconn *);
 int vconn_recv(struct vconn *, struct ofpbuf **);
 int vconn_send(struct vconn *, struct ofpbuf *);
-- 
1.7.2.5

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

Reply via email to