On tor, 2007-01-11 at 18:05 +0100, Magnus Fromreide wrote:
> On Thu, Jan 11, 2007 at 05:24:40PM +0100, Radek Vokál wrote:
> >
> > I'm sending you a patch which fixies the issue for me. This is Fedora
> > Core 6 and RHEL5 issue. Net-snmp 5.3.1 and 5.4
>
> I am against this patch since it breaks with not-so-old linux versions.
>
> The relevant change in the linux kernel code happened between 2.6.17 and
> 2.6.18
> so this is way out.
>
> The other thing is that the following might be an outline that works with both
> versions.
>
> AC_CHECK_HEADERS([linux/types.h])
> AC_CHECK_HEADERS([linux/eth_tool.h],[],[],[
> #ifdef HAVE_LINUX_TYPES_H
> #include <linux/types.h>
> #endif])
Further checking shows that <linux/types.h> showed up between 1.0.9 and
1.2.13 while <linux/ethtool.h> showed up between 2.2.26 and 2.4.18 so if
ethtool.h exists then types.h also exists.
types.h have always declared the __uN versions.
Thus the attached patch should work for all versions (Tested on kernel
2.6.18.6, if someone could test it on older versions as well then that
would be nice)
/MF
Index: configure.in
===================================================================
RCS file: /cvsroot/net-snmp/net-snmp/configure.in,v
retrieving revision 5.299
diff -u -r5.299 configure.in
--- configure.in 2 Jan 2007 10:34:53 -0000 5.299
+++ configure.in 11 Jan 2007 21:54:33 -0000
@@ -3261,13 +3261,13 @@
# linux ethtool
# requires special hacks to get around various problems on older linux kernels.
# major ugh....
-AC_CHECK_HEADERS(linux/ethtool.h,,,
+AC_CHECK_HEADERS([linux/ethtool.h],,,
[[
-#include <sys/types.h>
-typedef unsigned long long u64; /* hack, so we may include kernel's ethtool.h */
-typedef __uint32_t u32; /* ditto */
-typedef __uint16_t u16; /* ditto */
-typedef __uint8_t u8; /* ditto */
+#include <linux/types.h>
+typedef __u64 u64; /* hack, so we may include kernel's ethtool.h */
+typedef __u32 u32; /* ditto */
+typedef __u16 u16; /* ditto */
+typedef __u8 u8; /* ditto */
]])
# BSDi3 headers
AC_CHECK_HEADERS(sys/stat.h)
Index: agent/mibgroup/if-mib/data_access/interface_linux.c
===================================================================
RCS file: /cvsroot/net-snmp/net-snmp/agent/mibgroup/if-mib/data_access/interface_linux.c,v
retrieving revision 1.38
diff -u -r1.38 interface_linux.c
--- agent/mibgroup/if-mib/data_access/interface_linux.c 21 Sep 2006 13:09:18 -0000 1.38
+++ agent/mibgroup/if-mib/data_access/interface_linux.c 11 Jan 2007 21:54:34 -0000
@@ -26,10 +26,11 @@
#include <unistd.h>
#ifdef HAVE_LINUX_ETHTOOL_H
-typedef unsigned long long u64; /* hack, so we may include kernel's ethtool.h */
-typedef __uint32_t u32; /* ditto */
-typedef __uint16_t u16; /* ditto */
-typedef __uint8_t u8; /* ditto */
+#include <linux/types.h>
+typedef __u64 u64; /* hack, so we may include kernel's ethtool.h */
+typedef __u32 u32; /* ditto */
+typedef __u16 u16; /* ditto */
+typedef __u8 u8; /* ditto */
#include <linux/ethtool.h>
#endif /* HAVE_LINUX_ETHTOOL_H */
#include <linux/sockios.h>
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders