@@ -749,6 +749,9 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
[OVS_DEFINE([HAVE_DEFRAG_ENABLE_TAKES_NET])])
OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [family_list],
[OVS_DEFINE([HAVE_GENL_FAMILY_LIST])])
+ OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/netdevice.h], [net_device],
+ [needs_free_netdev],
+ [OVS_DEFINE([HAVE_NEEDS_FREE_NETDEV])])
OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_helper.h],
[nf_conntrack_helper_put])
@@ -114,7 +114,9 @@ static void internal_dev_destructor(struct net_device *dev)
struct vport *vport = ovs_internal_dev_get_vport(dev);
ovs_vport_free(vport);
+#ifndef HAVE_NEEDS_FREE_NETDEV
free_netdev(dev);
+#endif
}
static void
@@ -188,7 +190,12 @@ static void do_setup(struct net_device *netdev)
netdev->priv_flags &= ~IFF_TX_SKB_SHARING;
netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_OPENVSWITCH |
IFF_PHONY_HEADROOM | IFF_NO_QUEUE;
+#ifndef HAVE_NEEDS_FREE_NETDEV
netdev->destructor = internal_dev_destructor;
+#else
+ netdev->needs_free_netdev = true;
+ netdev->priv_destructor = internal_dev_destructor;
+#endif /* HAVE_NEEDS_FREE_NETDEV */
netdev->ethtool_ops = &internal_dev_ethtool_ops;
netdev->rtnl_link_ops = &internal_dev_link_ops;