X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=utilities%2Fovs-dpctl.c;h=886cdb3ac5318750a1e805b2d84d1f1d788136ad;hb=43a6c464efaf271411c8e2d19357e11bf6ff5afa;hp=c44291b6399634fce38b31ce057d690cb1a4c3e8;hpb=a14bc59fb8f27db193d74662dc9c5cb8237177ef;p=openvswitch diff --git a/utilities/ovs-dpctl.c b/utilities/ovs-dpctl.c index c44291b6..886cdb3a 100644 --- a/utilities/ovs-dpctl.c +++ b/utilities/ovs-dpctl.c @@ -36,6 +36,7 @@ #include "dynamic-string.h" #include "netdev.h" #include "odp-util.h" +#include "svec.h" #include "timeval.h" #include "util.h" @@ -157,6 +158,7 @@ usage(void) " del-dp DP delete local datapath DP\n" " add-if DP IFACE... add each IFACE as a port on DP\n" " del-if DP IFACE... delete each IFACE from DP\n" + " dump-dps display names of all datapaths\n" " show show basic info on all datapaths\n" " show DP... show basic info on each DP\n" " dump-flows DP display flows in DP\n" @@ -425,7 +427,7 @@ show_dpif(struct dpif *dpif) } static void -do_show(int argc UNUSED, char *argv[]) +do_show(int argc, char *argv[]) { bool failure = false; if (argc > 1) { @@ -465,6 +467,35 @@ do_show(int argc UNUSED, char *argv[]) } } +static void +do_dump_dps(int argc UNUSED, char *argv[] UNUSED) +{ + struct svec all_dps; + unsigned int i; + int error; + + svec_init(&all_dps); + error = dp_enumerate(&all_dps); + + for (i = 0; i < all_dps.n; i++) { + struct dpif dpif; + char dpif_name[IF_NAMESIZE]; + + if (dpif_open(all_dps.names[i], &dpif)) { + continue; + } + if (!dpif_get_name(&dpif, dpif_name, sizeof dpif_name)) { + printf("%s\n", dpif_name); + } + dpif_close(&dpif); + } + + svec_destroy(&all_dps); + if (error) { + exit(EXIT_FAILURE); + } +} + static void do_dump_flows(int argc UNUSED, char *argv[]) { @@ -543,6 +574,7 @@ static struct command all_commands[] = { { "del-dp", 1, 1, do_del_dp }, { "add-if", 2, INT_MAX, do_add_if }, { "del-if", 2, INT_MAX, do_del_if }, + { "dump-dps", 0, 0, do_dump_dps }, { "show", 0, INT_MAX, do_show }, { "dump-flows", 1, 1, do_dump_flows }, { "del-flows", 1, 1, do_del_flows },