vonn: Allow snoops to use the OpenFlow version of the controller connection
[openvswitch] / lib / rconn.c
index 28c23b5771e17ca2053f112f6939204c31c35304..a6b634bc702057fe6b43fd0073434044edb807d6 100644 (file)
@@ -135,6 +135,11 @@ struct rconn {
     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 *);
@@ -671,6 +676,14 @@ void
 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 {