Re: Datagram source address question
Pontus Lidman wrote:
> 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.
>
> 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.
Maybe reasonable, but source address selection should give the client
the same global scope source address as the destination address (longest
prefix match).
> The server responds to ::1 with a reply. Now the problems start:
>
> Even though I used bind() to bind the server socket to an explicit
> address, the source address of the server->client datagram turns out to be
> ::1, as determined from what recvfrom() puts in the from address argument.
This shouldn't happen. The source address selection should not override
an explicitly bound source address.
> So when the client in turn replies, it will send to ::1, which is an
> address the server is not listening to, and the communication comes to a
> halt.
>
> Is this a bug in the IPv6 stack, or have I misunderstood something?
Well, it looks to me that there is a problem with source address
selection. Possibly some weird loopback "optimization". Which kernel
version are you running, anyway?
> Pontus
MikaL
Reply to: