The patch below fixes the IPv6-enabled Win32 build. What this patch does is
to hide the inet_ntop() and inet_pton() declarations from the Microsoft SDK
headers such that these do not cause conflicts with the declarations in the
Net-SNMP source tree. And even when Net-SNMP is running on a Windows system
where inet_ntop() and inet_pton() are available in the kernel, the Net-SNMP
implementations of inet_pton() and inet_ntop() are used. This patch is a
backport from the trunk, and has been developed and tested against the V5.4
tree.
I´ll wait with committing this patch until Dave has had a chance to comment
and/or vote on this patch, so the vote window will be longer than the usual
24 hours.
Index: win32/net-snmp/net-snmp-config.h.in
===================================================================
--- win32/net-snmp/net-snmp-config.h.in (revision 18536)
+++ win32/net-snmp/net-snmp-config.h.in (working copy)
@@ -21,6 +21,12 @@
*/
/* #undef HAVE_WIN32_PLATFORM_SDK */
+/* Only use Windows API functions available on Windows 2000 SP4 or later.
+ * We need at least SP1 for some IPv6 defines in ws2ipdef.h
+ */
+#define _WIN32_WINNT 0x500 /*_WIN32_WINNT_WIN2K*/
+#define NTDDI_VERSION 0x05000400 /* NTDDI_WIN2KSP4 */
+
#define INSTALL_BASE "c:/usr"
/* config.h: a general config file */
@@ -1642,21 +1648,21 @@
#define EXTENSIBLEMIB NETSNMP_UCDAVIS_MIB
#endif
-#if defined(_MSC_VER)
-/* this bit of magic enables or disables IPv6 transports */
- #if NETSNMP_ENABLE_IPV6
- /* "dont have" implies "compile here" for snmplib/inet_?to?.c */
- #undef HAVE_INET_NTOP
- #undef HAVE_INET_PTON
- #define NETSNMP_TRANSPORT_TCPIPV6_DOMAIN 1
- #define NETSNMP_TRANSPORT_UDPIPV6_DOMAIN 1
- #else
- /* "have" implies "dont compile here" for snmplib/inet_?to?.c */
- #define HAVE_INET_NTOP 1
- #define HAVE_INET_PTON 1
- #undef NETSNMP_TRANSPORT_TCPIPV6_DOMAIN
- #undef NETSNMP_TRANSPORT_UDPIPV6_DOMAIN
+/* Windows Vista and higher have inet_ntop but older Windows does not.
+ * We'll use the Net-SNMP version instead. */
+#undef HAVE_INET_NTOP
+#undef HAVE_INET_PTON
+
+#if NETSNMP_ENABLE_IPV6
+ #ifndef IPPROTO_IPV6
+ /* Only defined in Windows XP or higher, so we need it here */
+ #define IPPROTO_IPV6 41
#endif
+ #define NETSNMP_TRANSPORT_TCPIPV6_DOMAIN 1
+ #define NETSNMP_TRANSPORT_UDPIPV6_DOMAIN 1
+#else
+ #undef NETSNMP_TRANSPORT_TCPIPV6_DOMAIN
+ #undef NETSNMP_TRANSPORT_UDPIPV6_DOMAIN
#endif
#ifndef NI_MAXHOST
Index: win32/net-snmp/net-snmp-config.h
===================================================================
--- win32/net-snmp/net-snmp-config.h (revision 18536)
+++ win32/net-snmp/net-snmp-config.h (working copy)
@@ -21,6 +21,12 @@
*/
/* #undef HAVE_WIN32_PLATFORM_SDK */
+/* Only use Windows API functions available on Windows 2000 SP4 or later.
+ * We need at least SP1 for some IPv6 defines in ws2ipdef.h
+ */
+#define _WIN32_WINNT 0x500 /*_WIN32_WINNT_WIN2K*/
+#define NTDDI_VERSION 0x05000400 /* NTDDI_WIN2KSP4 */
+
#define INSTALL_BASE "c:/usr"
/* config.h: a general config file */
@@ -1642,21 +1648,21 @@
#define EXTENSIBLEMIB NETSNMP_UCDAVIS_MIB
#endif
-#if defined(_MSC_VER)
-/* this bit of magic enables or disables IPv6 transports */
- #if NETSNMP_ENABLE_IPV6
- /* "dont have" implies "compile here" for snmplib/inet_?to?.c */
- #undef HAVE_INET_NTOP
- #undef HAVE_INET_PTON
- #define NETSNMP_TRANSPORT_TCPIPV6_DOMAIN 1
- #define NETSNMP_TRANSPORT_UDPIPV6_DOMAIN 1
- #else
- /* "have" implies "dont compile here" for snmplib/inet_?to?.c */
- #define HAVE_INET_NTOP 1
- #define HAVE_INET_PTON 1
- #undef NETSNMP_TRANSPORT_TCPIPV6_DOMAIN
- #undef NETSNMP_TRANSPORT_UDPIPV6_DOMAIN
+/* Windows Vista and higher have inet_ntop but older Windows does not.
+ * We'll use the Net-SNMP version instead. */
+#undef HAVE_INET_NTOP
+#undef HAVE_INET_PTON
+
+#if NETSNMP_ENABLE_IPV6
+ #ifndef IPPROTO_IPV6
+ /* Only defined in Windows XP or higher, so we need it here */
+ #define IPPROTO_IPV6 41
#endif
+ #define NETSNMP_TRANSPORT_TCPIPV6_DOMAIN 1
+ #define NETSNMP_TRANSPORT_UDPIPV6_DOMAIN 1
+#else
+ #undef NETSNMP_TRANSPORT_TCPIPV6_DOMAIN
+ #undef NETSNMP_TRANSPORT_UDPIPV6_DOMAIN
#endif
#ifndef NI_MAXHOST
Index: win32/net-snmp/net-snmp-config.h.in
===================================================================
--- win32/net-snmp/net-snmp-config.h.in (revision 18536)
+++ win32/net-snmp/net-snmp-config.h.in (working copy)
@@ -21,6 +21,12 @@
*/
/* #undef HAVE_WIN32_PLATFORM_SDK */
+/* Only use Windows API functions available on Windows 2000 SP4 or later.
+ * We need at least SP1 for some IPv6 defines in ws2ipdef.h
+ */
+#define _WIN32_WINNT 0x500 /*_WIN32_WINNT_WIN2K*/
+#define NTDDI_VERSION 0x05000400 /* NTDDI_WIN2KSP4 */
+
#define INSTALL_BASE "c:/usr"
/* config.h: a general config file */
@@ -1642,21 +1648,21 @@
#define EXTENSIBLEMIB NETSNMP_UCDAVIS_MIB
#endif
-#if defined(_MSC_VER)
-/* this bit of magic enables or disables IPv6 transports */
- #if NETSNMP_ENABLE_IPV6
- /* "dont have" implies "compile here" for snmplib/inet_?to?.c */
- #undef HAVE_INET_NTOP
- #undef HAVE_INET_PTON
- #define NETSNMP_TRANSPORT_TCPIPV6_DOMAIN 1
- #define NETSNMP_TRANSPORT_UDPIPV6_DOMAIN 1
- #else
- /* "have" implies "dont compile here" for snmplib/inet_?to?.c */
- #define HAVE_INET_NTOP 1
- #define HAVE_INET_PTON 1
- #undef NETSNMP_TRANSPORT_TCPIPV6_DOMAIN
- #undef NETSNMP_TRANSPORT_UDPIPV6_DOMAIN
+/* Windows Vista and higher have inet_ntop but older Windows does not.
+ * We'll use the Net-SNMP version instead. */
+#undef HAVE_INET_NTOP
+#undef HAVE_INET_PTON
+
+#if NETSNMP_ENABLE_IPV6
+ #ifndef IPPROTO_IPV6
+ /* Only defined in Windows XP or higher, so we need it here */
+ #define IPPROTO_IPV6 41
#endif
+ #define NETSNMP_TRANSPORT_TCPIPV6_DOMAIN 1
+ #define NETSNMP_TRANSPORT_UDPIPV6_DOMAIN 1
+#else
+ #undef NETSNMP_TRANSPORT_TCPIPV6_DOMAIN
+ #undef NETSNMP_TRANSPORT_UDPIPV6_DOMAIN
#endif
#ifndef NI_MAXHOST
Index: win32/net-snmp/net-snmp-config.h
===================================================================
--- win32/net-snmp/net-snmp-config.h (revision 18536)
+++ win32/net-snmp/net-snmp-config.h (working copy)
@@ -21,6 +21,12 @@
*/
/* #undef HAVE_WIN32_PLATFORM_SDK */
+/* Only use Windows API functions available on Windows 2000 SP4 or later.
+ * We need at least SP1 for some IPv6 defines in ws2ipdef.h
+ */
+#define _WIN32_WINNT 0x500 /*_WIN32_WINNT_WIN2K*/
+#define NTDDI_VERSION 0x05000400 /* NTDDI_WIN2KSP4 */
+
#define INSTALL_BASE "c:/usr"
/* config.h: a general config file */
@@ -1642,21 +1648,21 @@
#define EXTENSIBLEMIB NETSNMP_UCDAVIS_MIB
#endif
-#if defined(_MSC_VER)
-/* this bit of magic enables or disables IPv6 transports */
- #if NETSNMP_ENABLE_IPV6
- /* "dont have" implies "compile here" for snmplib/inet_?to?.c */
- #undef HAVE_INET_NTOP
- #undef HAVE_INET_PTON
- #define NETSNMP_TRANSPORT_TCPIPV6_DOMAIN 1
- #define NETSNMP_TRANSPORT_UDPIPV6_DOMAIN 1
- #else
- /* "have" implies "dont compile here" for snmplib/inet_?to?.c */
- #define HAVE_INET_NTOP 1
- #define HAVE_INET_PTON 1
- #undef NETSNMP_TRANSPORT_TCPIPV6_DOMAIN
- #undef NETSNMP_TRANSPORT_UDPIPV6_DOMAIN
+/* Windows Vista and higher have inet_ntop but older Windows does not.
+ * We'll use the Net-SNMP version instead. */
+#undef HAVE_INET_NTOP
+#undef HAVE_INET_PTON
+
+#if NETSNMP_ENABLE_IPV6
+ #ifndef IPPROTO_IPV6
+ /* Only defined in Windows XP or higher, so we need it here */
+ #define IPPROTO_IPV6 41
#endif
+ #define NETSNMP_TRANSPORT_TCPIPV6_DOMAIN 1
+ #define NETSNMP_TRANSPORT_UDPIPV6_DOMAIN 1
+#else
+ #undef NETSNMP_TRANSPORT_TCPIPV6_DOMAIN
+ #undef NETSNMP_TRANSPORT_UDPIPV6_DOMAIN
#endif
#ifndef NI_MAXHOST
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders