Problems with IPv6-related include files on Windows

Stefan Puiu stefanpuiu at itcnetworks.ro
Mon Feb 14 09:51:34 UTC 2005


Danny, so far linking with the BIND 9 libraries I'm interested in works 
ok, provided that I set the include directory list right - i.e. the 
win32 include dirs before the ones under lib/isc/include. However, there 
were some things about the way BIND is built that made things more 
confusing.

One of the confusing things was having two files referenced as 
<isc/ipv6.h> in the include search list (also <isc/net.h> and a few 
others); another one was the different handling of stuff like IPv6 
between UNIX and Windows - on UNIX you #define ISC_PLATFORM_HAVEINADDR6 
to 1 when you have in_addr6 instead of in6_addr in platform.h, on 
Windows there's a check for the compiler version in ipv6.h and if the 
version is lower than a certain number, in6_addr is defined to be 
in_addr6. I didn't find the ...HAVEINADDR6 define in the Win32 
platform.h, so I assumed there was an error in the build; actually there 
was no error, only the same issue was handled differently on UNIX and 
Windows. I'm guessing the fact that autoconf doesn't run on Windows was 
one of the causes for that, but maybe all those chunks with "#if 
_MSC_VER < 1300 ..." are better put in 
lib/isc/win32/include/isc/platform.h. .

Danny Mayer wrote:

> Stefan,
>
> The problem you are running into is that you've installed MSDEV with
> VS V6. The code builds for V6 without MSDEV and V7 (.NET) which
> has all of that stuff built in. You need to go into the config.h file and
> fix it to handle MSDEV as if it were V7. I don't have time to go into
> the details, but we had a similar problem with NTP. The solution's
> basically the same.
>
> Danny
>
> At 01:21 PM 2/10/2005, 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