[ovs-dev] [stp_tcn 2/2] stp: Allow manual topology change events.
Ethan Jackson
ethan at nicira.com
Wed Jan 25 03:17:12 UTC 2012
Here's an incremental.
---
lib/stp.c | 22 ++++++++++++++++------
vswitchd/ovs-vswitchd.8.in | 6 ++++--
2 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/lib/stp.c b/lib/stp.c
index 67a93d0..ba27306 100644
--- a/lib/stp.c
+++ b/lib/stp.c
@@ -210,7 +210,8 @@ static void stp_unixctl_tcn(struct unixctl_conn *, int argc,
void
stp_init(void)
{
- unixctl_command_register("stp/tcn", "bridge", 1, 1, stp_unixctl_tcn, NULL);
+ unixctl_command_register("stp/tcn", "[bridge]", 0, 1, stp_unixctl_tcn,
+ NULL);
}
/* Creates and returns a new STP instance that initially has no ports enabled.
@@ -1360,15 +1361,24 @@ stp_find(const char *name)
}
static void
-stp_unixctl_tcn(struct unixctl_conn *conn, int argc OVS_UNUSED,
+stp_unixctl_tcn(struct unixctl_conn *conn, int argc,
const char *argv[], void *aux OVS_UNUSED)
{
- struct stp *stp = stp_find(argv[1]);
+ if (argc > 1) {
+ struct stp *stp = stp_find(argv[1]);
- if (stp) {
+ if (!stp) {
+ unixctl_command_reply(conn, 501, "no such stp object");
+ return;
+ }
stp_topology_change_detection(stp);
- unixctl_command_reply(conn, 200, "OK");
} else {
- unixctl_command_reply(conn, 501, "no such stp object");
+ struct stp *stp;
+
+ LIST_FOR_EACH (stp, node, &all_stps) {
+ stp_topology_change_detection(stp);
+ }
}
+
+ unixctl_command_reply(conn, 200, "OK");
}
diff --git a/vswitchd/ovs-vswitchd.8.in b/vswitchd/ovs-vswitchd.8.in
index e34ae4c..01dfcdf 100644
--- a/vswitchd/ovs-vswitchd.8.in
+++ b/vswitchd/ovs-vswitchd.8.in
@@ -118,9 +118,11 @@ Displays detailed information about Connectivity Fault Management
configured on \fIinterface\fR. If \fIinterface\fR is not specified,
then displays detailed information about all interfaces with CFM
enabled.
-.IP "\fBstp/tcn\fR \fIbridge\fR"
+.IP "\fBstp/tcn\fR [\fIbridge\fR]"
Forces a topology change event on \fIbridge\fR if it's running STP. This
-may cause it to send Topology Change Notifications to its peers.
+may cause it to send Topology Change Notifications to its peers and flush
+its MAC table.. If no \fIbridge\fR is given, forces a topology change
+event on all bridges.
.SS "BRIDGE COMMANDS"
These commands manage bridges.
.IP "\fBfdb/flush\fR [\fIbridge\fR]"
--
1.7.8.3
More information about the dev
mailing list