From 9aa1cc9df8af45112f67c34a4d5606e2fb8c7212 Mon Sep 17 00:00:00 2001 From: Giuseppe Lettieri Date: Wed, 9 May 2012 12:17:15 +0200 Subject: [PATCH] proper destruction of netdev datapaths Bridges with datapath_type=netdev do not destroy the datapath when deleted. In particular, the tap device implementing the internal interface is not close()d, and therefore the tap persists until ovs-vswitchd exit()s. This behaviour appears to be caused by the missing callback for 'enumerate' in the dpif-netdev class. Without this callback 'bridge_reconfigure' fails to realize that there are datapaths with no bridge, and thus cannot destroy them. Providing an 'enumerate' callback fixes this. --- lib/dpif-netdev.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 9e8d5e4b9..fb23fa3ad 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -165,6 +165,17 @@ get_dp_netdev(const struct dpif *dpif) return dpif_netdev_cast(dpif)->dp; } +static int +dpif_netdev_enumerate(struct sset *all_dps) +{ + struct shash_node *node; + + SHASH_FOR_EACH(node, &dp_netdevs) { + sset_add(all_dps, node->name); + } + return 0; +} + static struct dpif * create_dpif_netdev(struct dp_netdev *dp) { @@ -1249,7 +1260,7 @@ dp_netdev_execute_actions(struct dp_netdev *dp, } #define DPIF_NETDEV_CLASS_FUNCTIONS \ - NULL, /* enumerate */ \ + dpif_netdev_enumerate, \ dpif_netdev_open, \ dpif_netdev_close, \ dpif_netdev_destroy, \ -- 2.43.0