From: Giuseppe Lettieri Date: Wed, 9 May 2012 10:17:15 +0000 (+0200) Subject: dpif-netdev: allow for proper destruction of netdev datapaths X-Git-Tag: sliver-openvswitch-1.8.90-0~48^2~431 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=2197d7abab6d765013399790d11290562a583b71;p=sliver-openvswitch.git dpif-netdev: allow for proper destruction of netdev datapaths Until now, bridges with datapath_type=netdev did not destroy the datapath when deleted. In particular, the tap device implementing the internal interface was not close()d, and therefore the tap persists until ovs-vswitchd exit()s. This behaviour was caused by the missing callback for 'enumerate' in the dpif-netdev class. Without this callback 'bridge_reconfigure' failed to realize that there are datapaths with no bridge, and thus cannot destroy them. Providing an 'enumerate' callback fixes this. Signed-off-by: Giuseppe Lettieri Signed-off-by: Ben Pfaff --- diff --git a/AUTHORS b/AUTHORS index f488aedef..379b6ab07 100644 --- a/AUTHORS +++ b/AUTHORS @@ -24,6 +24,7 @@ Dominic Curran dominic.curran@citrix.com Edward Tomasz Napierała trasz@freebsd.org Ethan Jackson ethan@nicira.com Gaetano Catalli gaetano.catalli@gmail.com +Giuseppe Lettieri g.lettieri@iet.unipi.it Glen Gibb grg@stanford.edu Gurucharan Shetty gshetty@nicira.com Hao Zheng hzheng@nicira.com diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index a6c06fe9d..fb0a863e3 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) { @@ -1241,7 +1252,7 @@ dp_netdev_execute_actions(struct dp_netdev *dp, const struct dpif_class dpif_netdev_class = { "netdev", - NULL, /* enumerate */ + dpif_netdev_enumerate, dpif_netdev_open, dpif_netdev_close, dpif_netdev_destroy,