#define MAX_MONITORS 8
struct vconn *monitors[8];
size_t n_monitors;
+
+ uint32_t allowed_versions;
};
static unsigned int elapsed_in_this_state(const struct rconn *);
* 8 seconds is used.
*
* The new rconn is initially unconnected. Use rconn_connect() or
- * rconn_connect_unreliably() to connect it. */
+ * rconn_connect_unreliably() to connect it.
+ *
+ * Connections made by the rconn will automatically negotiate an OpenFlow
+ * protocol version acceptable to both peers on the connection. The version
+ * negotiated will be one of those in the 'allowed_versions' bitmap:
+ * version 'x' is allowed if allowed_versions & (1 << x) is nonzero. If
+ * 'allowed_versions' is zero, then OFPUTIL_DEFAULT_VERSIONS are allowed.
+ **/
struct rconn *
-rconn_create(int probe_interval, int max_backoff, uint8_t dscp)
+rconn_create(int probe_interval, int max_backoff, uint8_t dscp,
+ uint32_t allowed_versions)
{
struct rconn *rc = xzalloc(sizeof *rc);
rconn_set_dscp(rc, dscp);
rc->n_monitors = 0;
+ rc->allowed_versions = allowed_versions
+ ? allowed_versions
+ : OFPUTIL_DEFAULT_VERSIONS;
return rc;
}
VLOG_INFO("%s: connecting...", rc->name);
}
rc->n_attempted_connections++;
- retval = vconn_open(rc->target, 0, &rc->vconn, rc->dscp);
+ retval = vconn_open(rc->target, rc->allowed_versions,
+ &rc->vconn, rc->dscp);
if (!retval) {
rc->remote_ip = vconn_get_remote_ip(rc->vconn);
rc->local_ip = vconn_get_local_ip(rc->vconn);
struct rconn_packet_counter;
struct rconn *rconn_create(int inactivity_probe_interval,
- int max_backoff, uint8_t dscp);
+ int max_backoff, uint8_t dscp,
+ uint32_t allowed_versions);
void rconn_set_dscp(struct rconn *rc, uint8_t dscp);
uint8_t rconn_get_dscp(const struct rconn *rc);
void rconn_set_max_backoff(struct rconn *, int max_backoff);
char *name;
/* Passing default value for creation of the rconn */
- rconn = rconn_create(ofservice->probe_interval, 0, ofservice->dscp);
+ rconn = rconn_create(ofservice->probe_interval, 0,
+ ofservice->dscp, 0);
name = ofconn_make_name(mgr, vconn_get_name(vconn));
rconn_connect_unreliably(rconn, vconn, name);
free(name);
char *name = ofconn_make_name(mgr, target);
struct ofconn *ofconn;
- ofconn = ofconn_create(mgr, rconn_create(5, 8, dscp), OFCONN_PRIMARY, true);
+ ofconn = ofconn_create(mgr, rconn_create(5, 8, dscp, 0),
+ OFCONN_PRIMARY, true);
ofconn->pktbuf = pktbuf_create();
rconn_connect(ofconn->rconn, target, name);
hmap_insert(&mgr->controllers, &ofconn->hmap_node, hash_string(target, 0));
struct lswitch_config cfg;
struct rconn *rconn;
- rconn = rconn_create(60, 0, DSCP_DEFAULT);
+ rconn = rconn_create(60, 0, DSCP_DEFAULT, 0);
rconn_connect_unreliably(rconn, vconn, NULL);
cfg.mode = (action_normal ? LSW_NORMAL