[ovs-dev] [PATCH] ofproto-dpif: Flush MACs for deleted ports from every bridge.

Ben Pfaff blp at nicira.com
Thu Dec 15 19:49:31 UTC 2011


On Thu, Dec 15, 2011 at 09:35:14AM -0800, Ben Pfaff wrote:
> I think I'm going to try to write some unit tests for this before I
> push it.

I wrote some, but the unit test revealed a bug in the "dummy" dpif.
Please review this, and then I'll push both patches:

--8<--------------------------cut here-------------------------->8--

From: Ben Pfaff <blp at nicira.com>
Date: Thu, 15 Dec 2011 11:45:08 -0800
Subject: [PATCH] dpif-netdev: Correctly report types of dummy netdevs.

When dpif-netdev is in use as a "dummy" datapath, the devices that are
added to it have type "dummy", but the dpif methods that report the types
of ports reported that they had type "system".  This meant that every time
the bridge code reconfigured, it would see that the ports had the wrong
types and delete and re-add them, which had other undesirable effects such
as flushing the entire MAC learning table whenever ovs-vsctl changed the
configuration.
---
 lib/dpif-netdev.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index eb10134..2c416e3 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -458,7 +458,8 @@ answer_port_query(const struct dp_netdev_port *port,
                   struct dpif_port *dpif_port)
 {
     dpif_port->name = xstrdup(netdev_get_name(port->netdev));
-    dpif_port->type = xstrdup(port->internal ? "internal" : "system");
+    dpif_port->type = xstrdup(port->internal ? "internal"
+                              : netdev_get_type(port->netdev));
     dpif_port->port_no = port->port_no;
 }
 
@@ -550,7 +551,8 @@ dpif_netdev_port_dump_next(const struct dpif *dpif, void *state_,
             free(state->name);
             state->name = xstrdup(netdev_get_name(port->netdev));
             dpif_port->name = state->name;
-            dpif_port->type = port->internal ? "internal" : "system";
+            dpif_port->type = (char *) (port->internal ? "internal"
+                                        : netdev_get_type(port->netdev));
             dpif_port->port_no = port->port_no;
             state->port_no = port_no + 1;
             return 0;
-- 
1.7.4.4




More information about the dev mailing list