cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl with IPv6 support enabled on Windows

From: Kai Sommerfeld <Kai.Sommerfeld_at_sun.com>
Date: Tue, 04 Jan 2005 15:58:08 +0100

Hi,

Gisle Vanem wrote:

> "Kai Sommerfeld" said:
>
>> BUT... after having done this I noticed that the produced libcurl.dll
>> will work fine on Windows XP but can't even be loaded on Windows 2000.
>> getaddrinfo and other functions cannot be found in ws2_32.dll.
>
>
> IPv6 for Win-2000 is only available via the IPv6 Technology Preview,
> right? So
> doesn't this include an updated ws2_32.dll? Or is getaddrinfo in
> wship6.dll?
> Check with depends or pedump.

  According to wspiAPI.h inline implementations, for IPv6 Technology
Preview it's in wship6.dll, for XP and beyond it's in ws2_32.dll.

> If getaddrinfo() is in wship6.dll, one should use the WspiapiLoad() hack
> in <wspiapi.h>. I don't know since I've never tried W2K.

  The hack looks first for getaddrinfo in ws2_32 and additionally in
wship6. So it doesn't matter where getaddrinfo resides. The hack can
always be used. For instance, on Win2k (without IPv6 preview) ws2_32 is
present, but no getaddrinfo is exported. Therefore, IPv4 fallback will
be used. On WinXP, getaddrinfo is present in ws2_32 and will be used.

>
>> #if (defined(ENABLE_IPV6) || defined(CURLDEBUG)) && defined(_MSC_VER)
>> && \
>> (!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0500)
>> /*
>> * Needed to pull in the real getaddrinfo() and not the inline version
>> * in <wspiAPI.H> which doesn't support IPv6 (IPv4 only). <wspiAPI.H> is
>> * included from <ws2tcpip.h> for <= 0x0500 SDKs.
>> */
>> #undef _WIN32_WINNT
>> #define _WIN32_WINNT 0x0501
>> #endif
>>
>> Giving this, I'm wondering what the code in setup.h is actually good
>> for. Shouldn't it just be removed? I'd see no problems with this.
>
>
> I don't remember the exact reason for it now (link fail?). But I noted
> it would fall back to WspiapiLegacyGetAddrInfo() which is IPv4 only. If

  I just debugged it. There is actually no wrong fallback to the
IPv4-only fallback functions done. On 2k, fallback is used. On XP,
implementation in ws2_32.dll gets called.

> you get it working on Win-2K by changing/removing _WIN32_WINNT, it's
> probably the right thing.

  It works fine here on both XP and 2k after removing the whole code
block above. So, does anyone object if a provide a patch doing exactly this?

- Kai.
Received on 2005-01-04