[vlc-devel] [Patch] IPv6 hostname resolving on Win32

Jeroen Massar jeroen at unfix.org
Sun Feb 15 18:47:19 CET 2004



Due to the fact that I rather enter udp:@radio.unfix.org:1833
instead of udp:@[ff3e:3c:3ffe:8114:2000:240:8008:ad10]:1833 ;)

Diff against the current CVS:

jeroen at heaven:~/videolan/vlc/modules/misc/network$ cvs diff ipv6.c
Index: ipv6.c
RCS file: /var/cvs/videolan/vlc/modules/misc/network/ipv6.c,v
retrieving revision 1.15
diff -r1.15 ipv6.c
<         hints.ai_flags = AI_NUMERICHOST;
<         if( _getaddrinfo( psz_address, NULL, &hints, &res ) )
- ---
>         if( _getaddrinfo( psz_address, NULL, &hints, &res ) != 0)
<         if( _getaddrinfo( psz_address, NULL, &hints, &res ) )
- ---
>         memset(&hints, 0, sizeof(hints));
>         hints.ai_family = AF_INET6;
>         if( _getaddrinfo( psz_address, NULL, &hints, &res ) != 0)

I removed the AI_NUMERICHOST as that would cause only numeric
hosts to be resolved, next to that ==0 -> false thus the above
would always fail on windows boxes, odd that it didn't fail while
using IPv6 addresses though. I also added a memset() to the second
part to make sure that the hints for the following getaddrinfo()
where empty, even though most OS/libc's clear malloc()'d mem, one
should never depend on it ;)

More information about the vlc-devel mailing list