From: Eric Dumazet <eric.dumazet@gmail.com>
To: Changli Gao <xiaosuo@gmail.com>
Cc: David Miller <davem@davemloft.net>,
neilb@suse.de, shemminger@vyatta.com, netdev@vger.kernel.org
Subject: Re: Undefined behaviour of connect(fd, NULL, 0);
Date: Mon, 05 Apr 2010 17:56:52 +0200 [thread overview]
Message-ID: <1270483012.4722.161.camel@edumazet-laptop> (raw)
In-Reply-To: <w2n412e6f7f1004050223j3e15df91tcdf133670c636a85@mail.gmail.com>
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@gmail.com>
W: http://www.kernel.org/doc/man-pages
next prev parent reply other threads:[~2010-04-05 15:56 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-31 11:36 Undefined behaviour of connect(fd, NULL, 0); Neil Brown
2010-03-31 18:49 ` Stephen Hemminger
2010-03-31 20:24 ` Neil Brown
2010-03-31 21:14 ` Stephen Hemminger
2010-03-31 21:17 ` David Miller
2010-03-31 22:07 ` Neil Brown
2010-04-01 3:00 ` Changli Gao
2010-04-01 3:38 ` Neil Brown
2010-04-01 4:16 ` Changli Gao
2010-04-01 5:50 ` Changli Gao
2010-04-01 7:23 ` David Miller
2010-04-05 9:23 ` Changli Gao
2010-04-05 15:56 ` Eric Dumazet [this message]
2010-04-05 16:25 ` Andreas Schwab
2010-04-05 19:25 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1270483012.4722.161.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=neilb@suse.de \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.com \
--cc=xiaosuo@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox