[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1270483012.4722.161.camel@edumazet-laptop>
Date: Mon, 05 Apr 2010 17:56:52 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Changli Gao <xiaosuo@...il.com>
Cc: David Miller <davem@...emloft.net>, neilb@...e.de,
shemminger@...tta.com, netdev@...r.kernel.org
Subject: Re: Undefined behaviour of connect(fd, NULL, 0);
Le lundi 05 avril 2010 à 17:23 +0800, Changli Gao a écrit :
> I found this from the man page of FreeBSD's connect(2).
>
> Generally, stream sockets may successfully connect() only
> once; datagram sockets may use connect() multiple times to change their
> association. Datagram sockets may dissolve the association by connecting
> to an invalid address, such as a null address.
>
> And this from the man page of Darwin's connect(2).
>
> Datagram sockets may dissolve the association by connecting to an
> invalid address, such as a null address or an address with the address
> family set to AF_UNSPEC (the error EAFNOSUPPORT will be harmlessly
> returned).
>
> Since null address behavior has been defined by the others. I think
> Linux should be compatible with the others. So the patch submitted on
> this by me should not been applied. I'll work out another patch later.
>
As pointed by David, no sane application would use this facility until a
decade, I wonder why you insist so much for this minor detail.
Solaris man page extract :
"Datagram sockets can dissolve the association by connecting to a null
address."
What is a null address ?
1) A null pointer ?
2) a pointer to a zone, but length of this zone is 0
3) Or a pointer to a zone filled with NULL bytes ?
Linux implements the later interpretation. Its more than enough.
If a NULL pointer was implemented, man pages would use the following
words : "Datagram sockets can dissolve the association by connecting to
a NULL pointer (NULL second argument to connect())."
If you submit a patch to change connect() behavior, dont forget to send
appropriate changes to Michael, because in the end, nobody but you knows
how things are supposed to work if not documented.
MAN-PAGES: MANUAL PAGES FOR LINUX -- Sections 2, 3, 4, 5, and 7
M: Michael Kerrisk <mtk.manpages@...il.com>
W: http://www.kernel.org/doc/man-pages
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists