#ifndef __LINUX_IF_LINK_WRAPPER_H
#define __LINUX_IF_LINK_WRAPPER_H 1
+#include <linux/version.h>
+
+#ifdef HAVE_RTNL_LINK_STATS64
#include_next <linux/if_link.h>
+#else /* !HAVE_RTNL_LINK_STATS64 */
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
+#include_next <linux/if_link.h>
+#else
+/* Before 2.6.19 there was no <linux/if_link.h>. Instead all of the types now
+ * declared there were in <linux/if.h>. Unfortunately <linux/if.h> from 2.6.18
+ * conflicts badly enough with <net/if.h> to break the userspace build. All
+ * we really need from <linux/if_link.h> is struct rtnl_link_stats64, which in
+ * turn only really needs __u64. */
+#include <linux/types.h>
+#include <linux/netlink.h>
+#endif /* kernel < 2.6.19 */
-#include <linux/version.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
/* The main device statistics structure */
struct rtnl_link_stats64 {
__u64 rx_packets; /* total packets received */
__u64 rx_compressed;
__u64 tx_compressed;
};
-#endif /* linux kernel < 2.6.35 */
+#endif /* !HAVE_RTNL_LINK_STATS64 */
#endif