Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

getaddrinfo() IPv6 bug in WinXP SP1?

4 views
Skip to first unread message

Fulvio Risso

unread,
May 15, 2003, 7:44:05 AM5/15/03
to
Hi all.

I created a simple program that wants to open a connection toward a
remote server. I'm using the new RFC 3493 API in order to be
protocol-independent.
Here it is a fragment of the code:

======================================================
void server ()
{
struct addrinfo Hints, *AddrInfo;
int RetVal;

// Prepare to open a new socket
memset(&Hints, 0, sizeof(struct addrinfo));

Hints.ai_family = AF_UNSPEC; // Both IPv4 / IPv6
Hints.ai_socktype = SOCK_STREAM; // TCP
// Hints.ai_flags = AI_PASSIVE; // ready to bind() a socket

RetVal = getaddrinfo("netgroup.polito.it", "80", &Hints, &AddrInfo);
=====================================================

The problem is that, although the "netgroup.polito.it" host is
registered with both A and AAAA records (i.e. it has two addresses,
one IPv4 and one IPv6 registered with the same name), the
getaddrinfo() returns only one item into the AddrInfo chain. This item
refers to the IPv6 address of the host "netgroup.polito.it".

This is, I presume, a bug because my application cannot connect to the
server by means of an IPv4 transport (it does not know the server has
an IPv4 address).

The same code looks fine if the line "Hints.ai_flag" is enabled and
the host name is NULL (i.e. I want to open a server socket on the
local machine). In this case, the linked list returned into the
AddrInfo contains two values: the first that can be used to open an
IPv4 server socket, the second to open an IPv6 one.

If there anyone else that saw something like this?
It is really a bug?

Thanks,

fulvio

Mark Mosbrucker [MSFT]

unread,
May 20, 2003, 7:41:38 PM5/20/03
to
Out of curiosity if you use nslookup and set the type to all does it return
v4 as well as v6 addresses? It may be that your DNS server is just not
responding with the v4 address?

-Mark

--
This posting is provided "AS IS" with no warranties, and confers no rights.
--


"Fulvio Risso" <fulvio...@polito.it> wrote in message
news:d805a30b.03051...@posting.google.com...

Fulvio Risso

unread,
May 22, 2003, 9:02:24 AM5/22/03
to
Hi Mark.
No, it's not a DNS problem (as you can see).
Foe instance, W2k SP2 + IPv6 Tech Preview (i.e. the OS I had until
some months ago) worked fine.

Cheers,

fulvio

================================================================
C:\Documents and Settings\Fulvio>nslookup

> server 130.192.3.24
Default Server: giove.polito.it
Address: 130.192.3.24

> set type=all
> netgroup.polito.it
Server: giove.polito.it
Address: 130.192.3.24

netgroup.polito.it canonical name = netgroup-serv.polito.it
polito.it nameserver = leonardo.polito.it
polito.it nameserver = giove.polito.it

> netgroup-serv.polito.it
Server: giove.polito.it
Address: 130.192.3.24

netgroup-serv.polito.it internet address = 130.192.16.36
netgroup-serv.polito.it AAAA IPv6 address =
2001:760:400:1:210:4bff:fe35:f2fa
netgroup-serv.polito.it HINFO CPU = PC Pentium 400 OS = Win 2000
Server
netgroup-serv.polito.it text =

"PR: Fulvio Risso (DAUIN - 7008)"
netgroup-serv.polito.it text =

"SA: Fulvio Risso (DAUIN - 7008)"
netgroup-serv.polito.it text =

"ET: 00:10:4B:35:f2:fa"
polito.it nameserver = leonardo.polito.it
polito.it nameserver = giove.polito.it
>
================================================================

"Mark Mosbrucker [MSFT]" <mar...@online.microsoft.com> wrote in message news:<OzclclyH...@tk2msftngp13.phx.gbl>...

0 new messages