dpif-netdev: Correctly report types of dummy netdevs.
authorBen Pfaff <blp@nicira.com>
Fri, 16 Dec 2011 18:03:08 +0000 (10:03 -0800)
committerBen Pfaff <blp@nicira.com>
Thu, 22 Dec 2011 18:05:11 +0000 (10:05 -0800)
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.

Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/dpif-netdev.c

index eb10134..2c416e3 100644 (file)
@@ -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;