ovs-appctl: Add fdb/flush command
authorAnsis Atteka <aatteka@nicira.com>
Tue, 1 Nov 2011 19:08:04 +0000 (12:08 -0700)
committerAnsis Atteka <aatteka@nicira.com>
Tue, 1 Nov 2011 23:33:35 +0000 (16:33 -0700)
Added a new command that will allow to flush particular bridge's
MAC learning table.

Issue #7819

NEWS
ofproto/ofproto-dpif.c
vswitchd/ovs-vswitchd.8.in

diff --git a/NEWS b/NEWS
index f0baf372caad2794d5d1485f28db65e604cb79ab..41e224d536196dd9217432a5a11d6f472b018348 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,7 @@
 post-v1.3.0
 ------------------------
+    - ovs-appctl:
+      - New "fdb/flush" command to flush bridge's MAC learning table.
 
 
 v1.3.0 - xx xxx xxxx
index 3cceb6be8947e7163fd4479ca9dc1273a2cfe7f6..6c303bba341f7a6deeaac5e5297ba4303bbadb53 100644 (file)
@@ -5115,6 +5115,22 @@ ofproto_dpif_lookup(const char *name)
             : NULL);
 }
 
+static void
+ofproto_unixctl_fdb_flush(struct unixctl_conn *conn,
+                         const char *args, void *aux OVS_UNUSED)
+{
+    const struct ofproto_dpif *ofproto;
+
+    ofproto = ofproto_dpif_lookup(args);
+    if (!ofproto) {
+        unixctl_command_reply(conn, 501, "no such bridge");
+        return;
+    }
+    mac_learning_flush(ofproto->ml);
+
+    unixctl_command_reply(conn, 200, "table successfully flushed");
+}
+
 static void
 ofproto_unixctl_fdb_show(struct unixctl_conn *conn,
                          const char *args, void *aux OVS_UNUSED)
@@ -5367,6 +5383,8 @@ ofproto_dpif_unixctl_init(void)
     unixctl_command_register("ofproto/trace",
                       "bridge {tun_id in_port packet | odp_flow [-generate]}",
                       ofproto_unixctl_trace, NULL);
+    unixctl_command_register("fdb/flush", "bridge", ofproto_unixctl_fdb_flush,
+                             NULL);
     unixctl_command_register("fdb/show", "bridge", ofproto_unixctl_fdb_show,
                              NULL); 
     unixctl_command_register("ofproto/clog", "", ofproto_dpif_clog, NULL);
index 1f01091080a7fc044e463a8800acee4adf03b8e4..314fe60952bc351ba4812953542bbf39b1ef129e 100644 (file)
@@ -120,6 +120,8 @@ then displays detailed information about all interfaces with CFM
 enabled.
 .SS "BRIDGE COMMANDS"
 These commands manage bridges.
+.IP "\fBfdb/flush\fR \fIbridge\fR"
+Flushes \fIbridge\fR MAC address learning table.
 .IP "\fBfdb/show\fR \fIbridge\fR"
 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,