[ovs-dev] [tests 19/22] ofproto-dpif: Report port number consistently in "fdb/show" output.

Ben Pfaff blp at nicira.com
Fri Oct 26 00:02:15 UTC 2012


Previously, the port number was nondeterministic for bonds (it could be
any one of the port's interfaces).

Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 ofproto/ofproto-dpif.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 86a5361..3e1b7b3 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -6621,9 +6621,16 @@ ofproto_unixctl_fdb_show(struct unixctl_conn *conn, int argc OVS_UNUSED,
     ds_put_cstr(&ds, " port  VLAN  MAC                Age\n");
     LIST_FOR_EACH (e, lru_node, &ofproto->ml->lrus) {
         struct ofbundle *bundle = e->port.p;
+        struct ofport_dpif *port;
+        int odp_port = INT_MAX;
+
+        LIST_FOR_EACH (port, bundle_node, &bundle->ports) {
+            if (port->odp_port < odp_port) {
+                odp_port = port->odp_port;
+            }
+        }
         ds_put_format(&ds, "%5d  %4d  "ETH_ADDR_FMT"  %3d\n",
-                      ofbundle_get_a_port(bundle)->odp_port,
-                      e->vlan, ETH_ADDR_ARGS(e->mac),
+                      odp_port, e->vlan, ETH_ADDR_ARGS(e->mac),
                       mac_entry_age(ofproto->ml, e));
     }
     unixctl_command_reply(conn, ds_cstr(&ds));
-- 
1.7.2.5




More information about the dev mailing list