ofproto: Fix use-after-free error when ports disappear.
[sliver-openvswitch.git] / lib / netdev-vport.c
index 70cdf29..620c22e 100644 (file)
@@ -21,6 +21,7 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <sys/socket.h>
+#include <linux/openvswitch.h>
 #include <linux/rtnetlink.h>
 #include <net/if.h>
 #include <sys/ioctl.h>
@@ -38,7 +39,6 @@
 #include "netlink-notifier.h"
 #include "netlink-socket.h"
 #include "ofpbuf.h"
-#include "openvswitch/datapath-protocol.h"
 #include "openvswitch/tunnel.h"
 #include "packets.h"
 #include "route-table.h"
@@ -131,7 +131,8 @@ netdev_vport_get_vport_type(const struct netdev *netdev)
 
     return (is_vport_class(class) ? vport_class_cast(class)->type
             : class == &netdev_internal_class ? OVS_VPORT_TYPE_INTERNAL
-            : class == &netdev_linux_class ? OVS_VPORT_TYPE_NETDEV
+            : (class == &netdev_linux_class ||
+               class == &netdev_tap_class) ? OVS_VPORT_TYPE_NETDEV
             : OVS_VPORT_TYPE_UNSPEC);
 }
 
@@ -906,6 +907,7 @@ unparse_patch_config(const char *name OVS_UNUSED, const char *type OVS_UNUSED,
     NULL,                       /* set_mtu */               \
     NULL,                       /* get_ifindex */           \
     NULL,                       /* get_carrier */           \
+    NULL,                       /* get_carrier_resets */    \
     NULL,                       /* get_miimon */            \
     netdev_vport_get_stats,                                 \
     netdev_vport_set_stats,                                 \