X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=vswitchd%2Fbridge.c;h=9660aef9021f5f617d847465e7090e258d1f01d5;hb=033419e81cac78924359f375e4ca558380f094c4;hp=fed5d71d3741280391230a3467a7dfa02bac97a3;hpb=6586adf524275726f0482b219b50920a30f80570;p=openvswitch diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index fed5d71d..9660aef9 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -267,6 +267,7 @@ static uint64_t bridge_pick_datapath_id(struct bridge *, static uint64_t dpid_from_hash(const void *, size_t nbytes); static unixctl_cb_func bridge_unixctl_fdb_show; +static unixctl_cb_func cfm_unixctl_show; static unixctl_cb_func qos_unixctl_show; static void bond_init(void); @@ -345,6 +346,7 @@ bridge_init(const char *remote) /* Register unixctl commands. */ unixctl_command_register("fdb/show", bridge_unixctl_fdb_show, NULL); + unixctl_command_register("cfm/show", cfm_unixctl_show, NULL); unixctl_command_register("qos/show", qos_unixctl_show, NULL); unixctl_command_register("bridge/dump-flows", bridge_unixctl_dump_flows, NULL); @@ -1515,6 +1517,33 @@ bridge_unixctl_fdb_show(struct unixctl_conn *conn, ds_destroy(&ds); } +/* CFM unixctl user interface functions. */ +static void +cfm_unixctl_show(struct unixctl_conn *conn, + const char *args, void *aux OVS_UNUSED) +{ + struct ds ds = DS_EMPTY_INITIALIZER; + struct iface *iface; + const struct cfm *cfm; + + iface = iface_find(args); + if (!iface) { + unixctl_command_reply(conn, 501, "no such interface"); + return; + } + + cfm = ofproto_iface_get_cfm(iface->port->bridge->ofproto, iface->dp_ifidx); + + if (!cfm) { + unixctl_command_reply(conn, 501, "CFM not enabled"); + return; + } + + cfm_dump_ds(cfm, &ds); + unixctl_command_reply(conn, 200, ds_cstr(&ds)); + ds_destroy(&ds); +} + /* QoS unixctl user interface functions. */ struct qos_unixctl_show_cbdata {