From: Ben Pfaff Date: Thu, 16 Jul 2009 22:15:02 +0000 (-0700) Subject: vswitchd: Make "fdb/show" output more meaningful port numbers. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=092bebdc047b8a4944762a454ff8653baa563ced;p=openvswitch vswitchd: Make "fdb/show" output more meaningful port numbers. The "fdb/show" unixctl command was showing vswitch-internal port indexes, which cannot be meaningfully interpreted by software outside vswitchd. Also, they potentially change every time the vswitchd configuration file changes. This commit changes it to use a datapath port index instead, which are both more meaningful and more stable. --- diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index b0b2a8f1..6a82a031 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -809,9 +809,12 @@ bridge_unixctl_fdb_show(struct unixctl_conn *conn, const char *args) if (br->ml) { const struct mac_entry *e; LIST_FOR_EACH (e, struct mac_entry, lru_node, &br->ml->lrus) { + if (e->port < 0 || e->port >= br->n_ports) { + continue; + } ds_put_format(&ds, "%5d %4d "ETH_ADDR_FMT" %3d\n", - e->port, e->vlan, ETH_ADDR_ARGS(e->mac), - mac_entry_age(e)); + br->ports[e->port]->ifaces[0]->dp_ifidx, + e->vlan, ETH_ADDR_ARGS(e->mac), mac_entry_age(e)); } } unixctl_command_reply(conn, 200, ds_cstr(&ds));