This feature may be useful for debugging.
Feature #2222.
uint64_t old_dpid = p->datapath_id;
p->datapath_id = datapath_id ? datapath_id : pick_datapath_id(p);
if (p->datapath_id != old_dpid) {
- struct ofconn *ofconn;
-
VLOG_INFO("datapath ID changed to %016"PRIx64, p->datapath_id);
/* Force all active connections to reconnect, since there is no way to
* notify a controller that the datapath ID has changed. */
- LIST_FOR_EACH (ofconn, struct ofconn, node, &p->all_conns) {
- rconn_reconnect(ofconn->rconn);
- }
+ ofproto_reconnect_controllers(p);
}
}
}
}
+/* Drops the connections between 'ofproto' and all of its controllers, forcing
+ * them to reconnect. */
+void
+ofproto_reconnect_controllers(struct ofproto *ofproto)
+{
+ struct ofconn *ofconn;
+
+ LIST_FOR_EACH (ofconn, struct ofconn, node, &ofproto->all_conns) {
+ rconn_reconnect(ofconn->rconn);
+ }
+}
+
static bool
any_extras_changed(const struct ofproto *ofproto,
const struct sockaddr_in *extras, size_t n)
void ofproto_set_datapath_id(struct ofproto *, uint64_t datapath_id);
void ofproto_set_controllers(struct ofproto *,
const struct ofproto_controller *, size_t n);
+void ofproto_reconnect_controllers(struct ofproto *);
void ofproto_set_extra_in_band_remotes(struct ofproto *,
const struct sockaddr_in *, size_t n);
void ofproto_set_desc(struct ofproto *,
static void bridge_destroy(struct bridge *);
static struct bridge *bridge_lookup(const char *name);
static unixctl_cb_func bridge_unixctl_dump_flows;
+static unixctl_cb_func bridge_unixctl_reconnect;
static int bridge_run_one(struct bridge *);
static size_t bridge_get_controllers(const struct ovsrec_open_vswitch *ovs_cfg,
const struct bridge *br,
unixctl_command_register("fdb/show", bridge_unixctl_fdb_show, NULL);
unixctl_command_register("bridge/dump-flows", bridge_unixctl_dump_flows,
NULL);
+ unixctl_command_register("bridge/reconnect", bridge_unixctl_reconnect,
+ NULL);
bond_init();
}
ds_destroy(&results);
}
+/* "bridge/reconnect [BRIDGE]": makes BRIDGE drop all of its controller
+ * connections and reconnect. If BRIDGE is not specified, then all bridges
+ * drop their controller connections and reconnect. */
+static void
+bridge_unixctl_reconnect(struct unixctl_conn *conn,
+ const char *args, void *aux OVS_UNUSED)
+{
+ struct bridge *br;
+ if (args[0] != '\0') {
+ br = bridge_lookup(args);
+ if (!br) {
+ unixctl_command_reply(conn, 501, "Unknown bridge");
+ return;
+ }
+ ofproto_reconnect_controllers(br->ofproto);
+ } else {
+ LIST_FOR_EACH (br, struct bridge, node, &all_bridges) {
+ ofproto_reconnect_controllers(br->ofproto);
+ }
+ }
+ unixctl_command_reply(conn, 200, NULL);
+}
+
static int
bridge_run_one(struct bridge *br)
{
Lists each MAC address/VLAN pair learned by the specified \fIbridge\fR,
along with the port on which it was learned and the age of the entry,
in seconds.
+.IP "\fBbridge/reconnect\fR [\fIbridge\fR]"
+Makes \fIbridge\fR drop all of its OpenFlow controller connections and
+reconnect. If \fIbridge\fR is not specified, then all bridges drop
+their controller connections and reconnect.
+.IP
+This command might be useful for debugging OpenFlow controller issues.
.
.IP "\fBbridge/dump-flows\fR \fIbridge\fR"
Lists all flows in \fIbridge\fR, including those normally hidden to