We have to define our own with some kernel headers, so we might as well do it everywhere, especially since there seems to be a problem with detecting the presence of the definition with at least some kernels.
Reported-by: Wang Sheng-Hui <shh...@gmail.com> Signed-off-by: Ben Pfaff <b...@nicira.com> --- configure.ac | 2 -- lib/netdev-linux.c | 13 ++++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index a8a530a..62224b9 100644 --- a/configure.ac +++ b/configure.ac @@ -67,8 +67,6 @@ AC_CHECK_DECLS([sys_siglist], [], [], [[#include <signal.h>]]) AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec, struct stat.st_mtimensec], [], [], [[#include <sys/stat.h>]]) AC_CHECK_MEMBERS([struct ifreq.ifr_flagshigh], [], [], [[#include <net/if.h>]]) -AC_CHECK_TYPES([struct rtnl_link_stats64], [], [], - [[#include <linux/if_link.h>]]) AC_CHECK_FUNCS([mlockall strnlen getloadavg statvfs getmntent_r]) AC_CHECK_HEADERS([mntent.h sys/statvfs.h linux/types.h linux/if_ether.h stdatomic.h]) AC_CHECK_HEADERS([net/if_mib.h], [], [], [[#include <sys/types.h> diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index ff7c274..d19220b 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -138,9 +138,17 @@ struct tpacket_auxdata { uint16_t tp_vlan_tpid; }; -/* Linux 2.6.35 introduced IFLA_STATS64 and rtnl_link_stats64. */ -#ifndef HAVE_STRUCT_RTNL_LINK_STATS64 +/* Linux 2.6.35 introduced IFLA_STATS64 and rtnl_link_stats64. + * + * Tests for rtnl_link_stats64 don't seem to consistently work, e.g. on + * 2.6.32-431.29.2.el6.x86_64 (see report at + * http://openvswitch.org/pipermail/dev/2014-October/047978.html). Maybe + * if_link.h is not self-contained on those kernels. It is easiest to + * unconditionally define a replacement. */ +#ifndef IFLA_STATS64 #define IFLA_STATS64 23 +#endif +#define rtnl_link_stats64 rpl_rtnl_link_stats64 struct rtnl_link_stats64 { uint64_t rx_packets; uint64_t tx_packets; @@ -169,7 +177,6 @@ struct rtnl_link_stats64 { uint64_t rx_compressed; uint64_t tx_compressed; }; -#endif /* !HAVE_STRUCT_RTNL_LINK_STATS64 */ enum { VALID_IFINDEX = 1 << 0, -- 1.7.10.4 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev