From 733c8ed3b95e54f9245dc7175fc89cee672f9405 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 7 Aug 2012 11:33:35 -0700 Subject: [PATCH] vconn: Fix vconn_get_version(). It's documented to return -1 if the version isn't yet known, but in fact it returned 0. Signed-off-by: Ben Pfaff --- 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 eb848ba8..8b53b060 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 3bb44507..1a0bc60e 100644 --- a/lib/vconn.h +++ b/lib/vconn.h @@ -19,6 +19,7 @@ #include #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 *); -- 2.30.2