From 0f5293d8a5cadcc2111e38fd79f3d39f5c83cebc Mon Sep 17 00:00:00 2001 From: Giuseppe Lettieri Date: Thu, 24 Jan 2013 14:52:38 +0100 Subject: [PATCH] proper type for internal port of planetlab dpif do_add_port() directly calls dpif_netdev_port_open_type(), so we cannot rely on virtual method dispatch to have our dpif_planetlab_port_open_type() called. --- lib/dpif-netdev.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 6e7a5cca0..13f57157c 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -184,16 +184,9 @@ static const char * dpif_netdev_port_open_type(const struct dpif_class *class, const char *type) { return strcmp(type, "internal") ? type - : class != &dpif_netdev_class ? "dummy" - : "tap"; -} - -static const char * -dpif_planetlab_port_open_type(const struct dpif_class *class, const char *type) -{ - return strcmp(type, "internal") ? type - : class != &dpif_planetlab_class ? "dummy" - : "pltap"; + : class == &dpif_netdev_class ? "tap" + : class == &dpif_planetlab_class ? "pltap" + : "dummy"; } static struct dpif * @@ -1294,9 +1287,9 @@ dp_netdev_execute_actions(struct dp_netdev *dp, } } -#define DPIF_NETDEV_CLASS_FUNCTIONS(PORT_OPEN_TYPE) \ +#define DPIF_NETDEV_CLASS_FUNCTIONS \ dpif_netdev_enumerate, \ - PORT_OPEN_TYPE, \ + dpif_netdev_port_open_type, \ dpif_netdev_open, \ dpif_netdev_close, \ dpif_netdev_destroy, \ @@ -1331,12 +1324,12 @@ dp_netdev_execute_actions(struct dp_netdev *dp, const struct dpif_class dpif_netdev_class = { "netdev", - DPIF_NETDEV_CLASS_FUNCTIONS(dpif_netdev_port_open_type) + DPIF_NETDEV_CLASS_FUNCTIONS }; const struct dpif_class dpif_planetlab_class = { "planetlab", - DPIF_NETDEV_CLASS_FUNCTIONS(dpif_planetlab_port_open_type) + DPIF_NETDEV_CLASS_FUNCTIONS }; static void -- 2.43.0