Override the allowed versions of the snoop vconn so that
only the version of the controller connection is allowed.
This is because the snoop will see the same messages as the
controller.
Without this change the snoop will try to negotiate a connection
using the default allowed versions, or in other words only
allow OpenFlow 1.0. This breaks snoops for controller connections
using other OpenFlow versions, that is OpenFlow 1.2.
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
uint32_t allowed_versions;
};
uint32_t allowed_versions;
};
+uint32_t rconn_get_allowed_versions(const struct rconn *rconn)
+{
+ return rconn->allowed_versions;
+}
+
static unsigned int elapsed_in_this_state(const struct rconn *);
static unsigned int timeout(const struct rconn *);
static bool timed_out(const struct rconn *);
static unsigned int elapsed_in_this_state(const struct rconn *);
static unsigned int timeout(const struct rconn *);
static bool timed_out(const struct rconn *);
rconn_add_monitor(struct rconn *rc, struct vconn *vconn)
{
if (rc->n_monitors < ARRAY_SIZE(rc->monitors)) {
rconn_add_monitor(struct rconn *rc, struct vconn *vconn)
{
if (rc->n_monitors < ARRAY_SIZE(rc->monitors)) {
+ int version = vconn_get_version(rc->vconn);
+
+ /* Override the allowed versions of the snoop vconn so that
+ * only the version of the controller connection is allowed.
+ * This is because the snoop will see the same messages as the
+ * controller */
+ vconn_set_allowed_versions(vconn, 1u << version);
+
VLOG_INFO("new monitor connection from %s", vconn_get_name(vconn));
rc->monitors[rc->n_monitors++] = vconn;
} else {
VLOG_INFO("new monitor connection from %s", vconn_get_name(vconn));
rc->monitors[rc->n_monitors++] = vconn;
} else {
int max_backoff, uint8_t dscp,
uint32_t allowed_versions);
void rconn_set_dscp(struct rconn *rc, uint8_t dscp);
int max_backoff, uint8_t dscp,
uint32_t allowed_versions);
void rconn_set_dscp(struct rconn *rc, uint8_t dscp);
+uint32_t rconn_get_allowed_versions(const struct rconn *);
uint8_t rconn_get_dscp(const struct rconn *rc);
void rconn_set_max_backoff(struct rconn *, int max_backoff);
int rconn_get_max_backoff(const struct rconn *);
uint8_t rconn_get_dscp(const struct rconn *rc);
void rconn_set_max_backoff(struct rconn *, int max_backoff);
int rconn_get_max_backoff(const struct rconn *);
return vconn->allowed_versions;
}
return vconn->allowed_versions;
}
+/* Sets the allowed_versions of 'vconn', overriding
+ * the allowed_versions passed to vconn_open(). */
+void
+vconn_set_allowed_versions(struct vconn *vconn, uint32_t allowed_versions)
+{
+ vconn->allowed_versions = allowed_versions;
+}
+
/* Returns the IP address of the peer, or 0 if the peer is not connected over
* an IP-based protocol or if its IP address is not yet known. */
ovs_be32
/* Returns the IP address of the peer, or 0 if the peer is not connected over
* an IP-based protocol or if its IP address is not yet known. */
ovs_be32
void vconn_close(struct vconn *);
const char *vconn_get_name(const struct vconn *);
uint32_t vconn_get_allowed_versions(const struct vconn *vconn);
void vconn_close(struct vconn *);
const char *vconn_get_name(const struct vconn *);
uint32_t vconn_get_allowed_versions(const struct vconn *vconn);
+void vconn_set_allowed_versions(struct vconn *vconn,
+ uint32_t allowed_versions);
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_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 *);