vconn: Fix vconn_get_version().
authorBen Pfaff <blp@nicira.com>
Tue, 7 Aug 2012 18:33:35 +0000 (11:33 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 7 Aug 2012 19:41:58 +0000 (12:41 -0700)
It's documented to return -1 if the version isn't yet known, but in fact
it returned 0.

Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/vconn.c
lib/vconn.h

index eb848ba..8b53b06 100644 (file)
@@ -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
index 3bb4450..1a0bc60 100644 (file)
@@ -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 *);