Subject: Re: follow-up: discrepancy with POSIX

From: Ulrich Drepper <[email-masked]>
Date: Wed, 19 Sep 2007 09:49:09 -0700

Andi Kleen wrote:
> The standard way to undo connect is to use AF_UNSPEC. Code to handle
> that for dgram sockets is there. It's the same code for v4 and v6.

I quoted the standard and it does not say anything about AF_UNSPEC.  So
you cannot simply make such broad statements.

I also don't say that this behavior should be removed.  It's certainly
useful, very much so in fact.

But the spec calls for a "null address" to be used and that's in my
understanding something different from using AF_UNSPEC.

I looked through Stevens TCP Illustrated Vol 2 and it seems not to
mention resetting the address at all.  The POSIX spec certainly got this
text from .1g.

I cannot test it on other systems.  If somebody has access to some
certified systems (and maybe others), write a bit of code which creates
a DGRAM socket, connect to one address, call connect with a "null
address", then connect to another address (which likely has to use a
different interface since otherwise the connect will just succeed, it
seems).

- --
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖