diff options
author | Ethan Jackson <ethan@nicira.com> | 2012-01-24 14:33:23 -0800 |
---|---|---|
committer | Ethan Jackson <ethan@nicira.com> | 2012-01-24 15:14:04 -0800 |
commit | d031704eaf9bedb2d60eae0a728ef6fd30430338 (patch) | |
tree | b67b18ed5cd6c2873f29722f37cec7f31e239ac5 /ofproto | |
parent | 0845af5edf2fabca0be79ac65bc5c061ad2b8c77 (diff) |
ofproto: Optionally flush all learning tables with appctl.
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Diffstat (limited to 'ofproto')
-rw-r--r-- | ofproto/ofproto-dpif.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index d5ada4ca..dc857435 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -5590,17 +5590,24 @@ ofproto_dpif_lookup(const char *name) static void ofproto_unixctl_fdb_flush(struct unixctl_conn *conn, - const char *args, void *aux OVS_UNUSED) + const char *args, void *aux OVS_UNUSED) { struct ofproto_dpif *ofproto; - ofproto = ofproto_dpif_lookup(args); - if (!ofproto) { - unixctl_command_reply(conn, 501, "no such bridge"); - return; + if (args[0] != '\0') { + ofproto = ofproto_dpif_lookup(args); + if (!ofproto) { + unixctl_command_reply(conn, 501, "no such bridge"); + return; + } + mac_learning_flush(ofproto->ml); + ofproto->need_revalidate = true; + } else { + HMAP_FOR_EACH (ofproto, all_ofproto_dpifs_node, &all_ofproto_dpifs) { + mac_learning_flush(ofproto->ml); + ofproto->need_revalidate = true; + } } - mac_learning_flush(ofproto->ml); - ofproto->need_revalidate = true; unixctl_command_reply(conn, 200, "table successfully flushed"); } @@ -5865,8 +5872,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/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); |