Problems with IPv6-related include files on Windows

Stefan Puiu stefanpuiu at itcnetworks.ro
Thu Feb 10 18:37:35 UTC 2005


Ok, applying both changes seems to break the Win32 build, the wrapping 
of #include <isc/ipv6.h> being the main problem. The IPv6-related 
warnings seem to go away when putting lib/isc/win32/include before 
lib/isc/include in the includes directory search list, making one of the 
changes unnecessary. However, the:

d:\src\bind\bind-9.3.0\lib\isc\win32\include\isc\net.h(115) : error 
C2079: 'ipi6_addr' uses undefined struct 'in6_addr'

message is still there and I still need to edit the two files (or 
#define in6_addr in my app). I'll need to check, but only applying the 
part about ISC_PLATFORM_HAVEINADDR6 from the patches below shouldn't be 
harmful, IMO.

Stefan Puiu wrote:

>I've tried to write a simple wrapper library around the functionality 
>provided by cfg_parse_file()/bind9_check_namedconf() and the zone 
>parsing stuff, mainly inspired by what the named-check* binaries do; I'm 
>using the BIND 9.3.0 headers and libraries. I've tried building the 
>library on Windows 2000 using MS VC++ 6.0 (SP6), but I've stumbled on a 
>problem we're familiar with here: conflicts between BIND 9 includes and 
>various stuff in winsock2.h, mostly IPv6-related. We already have an app 
>that uses BIND 9.2.3 libraries and includes and a lot of the source 
>files are prefixed by an:
>
>#ifdef WIN32
># ifndef ISC_IPV6_H
># define ISC_IPV6_H 1
># endif
>#endif
>
>because otherwise sockaddr_in6 from isc/include/isc/ipv6.h would show up 
>as redefined - it's already defined in ws2tcpip.h in the MSDEV includes. 
>Now with BIND 9.3.0, doing that doesn't help for my test library, since 
>I'm getting another error about:
>
>d:\src\bind\bind-9.3.0\lib\isc\win32\include\isc\net.h(116) : error 
>C2079: 'ipi6_addr' uses undefined struct 'in6_addr'
>
>Digging a bit I see MSDEV 6 only has in_addr6 defined (ws2tcpip.h), not 
>in6_addr. In the lib/isc/include/isc/platform.h for Solaris, I noticed 
>this:
>
>/*
> * If this system has in_addr6, rather than in6_addr, 
>ISC_PLATFORM_HAVEINADDR6
> * will be defined.
> */
>#undef ISC_PLATFORM_HAVEINADDR6
>
>And in lib/isc/unix/include/isc/net.h:
>
>#ifdef ISC_PLATFORM_HAVEINADDR6
>#define in6_addr in_addr6       /* Required for pre RFC2133 
>implementations. */
>#endif
>
>Adding #define ISC_PLATFORM_HAVEINADDR6 to the Win32 platform.h and the 
>part above to lib/isc/win32/include/isc/net.h right before the line that 
>gives the said error fixes the problem - this is a fix I'd really love 
>to see in 9.3.1. I've checked, it isn't in 9.3.1beta2, and neither is 
>the one I'm talking about below.
>
>Another fix I needed to apply was in lib/isc/win32/include/isc/net.h by 
>wrapping the "#include <isc/ipv6.h>" line in a "#ifndef 
>ISC_PLATFORM_HAVEIPV6" block, just like things are right now in its UNIX 
>counterpart. These two fixes would make all compile errors go away. I've 
>attached two diffs, one for each file I had to edit.
>
>Any reason not to apply these simple changes? I don't know about MSDEV 
>7, though, maybe some #ifdefs to detect compiler/include file version 
>would also be needed in order to maintain compatibility.
>
>
>-- Attached file included as plaintext by Ecartis --
>-- File: platform.h.diff
>
>--- platform.h	2004-04-19 09:39:56.000000000 +0300
>+++ /d/src/bind/bind-9.3.0/lib/isc/win32/include/isc/platform.h	2005-02-10 20:05:26.269750000 +0200
>@@ -33,7 +33,8 @@
> #define ISC_PLATFORM_HAVEIPV6
> #if _MSC_VER > 1200
> #define ISC_PLATFORM_HAVEIN6PKTINFO
>-#endif
>+#endif
>+#define ISC_PLATFORM_HAVEINADDR6 1
> #define ISC_PLATFORM_NEEDPORTT
> #undef MSG_TRUNC
> #define ISC_PLATFORM_NEEDNTOP
>
>
>
>-- Attached file included as plaintext by Ecartis --
>-- File: net.h.diff
>
>--- net.h	2004-04-29 04:31:23.000000000 +0300
>+++ /d/src/bind/bind-9.3.0/lib/isc/win32/include/isc/net.h	2005-02-10 20:06:21.894750000 +0200
>@@ -98,7 +98,13 @@
> #include <isc/types.h>
> 
> #include <ws2tcpip.h>
>-#include <isc/ipv6.h>
>+#ifndef ISC_PLATFORM_HAVEIPV6
>+#include <isc/ipv6.h>
>+#endif
>+
>+#ifdef ISC_PLATFORM_HAVEINADDR6
>+#define in6_addr in_addr6       /* Required for pre RFC2133 implementations. */
>+#endif
> 
> /*
>  * This is here because named client, interfacemgr.c, etc. use the name as
>
>
>
>
>  
>



More information about the bind-users mailing list