[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Datagram source address question



On Tue, 13 Jun 2000, Hideaki YOSHIFUJI wrote:

> In article <[🔎] Pine.GSO.4.00.10006121722390.9387-100000@sandra.lysator.liu.se> (at Mon, 12 Jun 2000 17:35:43 +0200 (MET DST)), Pontus Lidman <pontus@lysator.liu.se> says:
> 
> > I create a datagram socket in my client application, and bind() it to the 
> > 'any' address. The server binds its socket to an explicit global scope
> > IPv6 address.
> 
> Do you mean in6addr_any by "'any' address"?
 
Yes, 0::0. I use getaddrinfo(NULL,NULL,...) to get it.
 
> > The client sends a datagram to the server, with a source address of
> > ::1, which is reasonable since the client and server executes on the same 
> > machine. The server responds to ::1 with a reply. Now the problems start:
> 
> What's the server's address? ::1 or whatever else?

The client sends the datagram to the global scope unicast address of the
my host, which runs both the client and the server. The server's listening
socket is bound to this address using bind(). The client uses the any
address for its listening socket.
 
> > Is this a bug in the IPv6 stack, or have I misunderstood something?
> 
> What is your problem?
> Source address selection, or whatever?
 
The problem is that when I send a datagram from the server, using
sendto(socket,...), where socket is bound to the global scope unicast
address, the datagram will still have the loopback address (::1) as the
source address. I thought it would have the bound address as source.
 
> How about IPv4? Does the same problem occur?

No. To clarify, when using ipv4-mapped ipv6 addresses (e.g.
::ffff:127.0.0.1) it works properly.

Regards,

Pontus

-- 
Pontus Lidman, pontus@mathcore.com, Software Engineer
No matter how cynical you get, it's impossible to keep up.
Scene: www.dc-s.com | MUD: tyme.envy.com 6969 | irc: irc.quakenet.eu.org



Reply to: