From: John Haxby <john.haxby@oracle.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: NetDev <netdev@vger.kernel.org>
Subject: Re: inet_hash_connect: source port allocation
Date: Mon, 29 Nov 2010 18:29:40 +0000 [thread overview]
Message-ID: <4CF3F114.2070108@oracle.com> (raw)
In-Reply-To: <1291051560.3435.1198.camel@edumazet-laptop>
On 29/11/10 17:26, Eric Dumazet wrote:
> Le lundi 29 novembre 2010 à 17:04 +0000, John Haxby a écrit :
>> Hello,
>>
>> Please forgive me if this is a stupid question, but is there any
>> particular reason why the source port allocation in
>> __inet_hash_connect() shouldn't use the same random allocation that
>> inet_csk_get_port() uses? The latter, of course, is used when bind()
>> doesn't specify a source port but the implicit "bind" for a connect()
>> gets its port allocated by __inet_hash_connect().
>>
>> jch
> autobind vs bind
>
> bind() gives more information, like local address (if any)
>
> autobind(), we dont know local address, it'll be chose later by routing.
Sorry, I think I phrased my question badly.
inet_csk_get_port() starts its search for a free port with
smallest_rover = rover = net_random() % remaining + low;
whereas __inet_hash_connect() basically misses out that call to
net_random() so you get a predictable port number.
Is there any good reason why that is the case?
jch
next prev parent reply other threads:[~2010-11-29 18:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-29 17:04 inet_hash_connect: source port allocation John Haxby
2010-11-29 17:26 ` Eric Dumazet
2010-11-29 18:29 ` John Haxby [this message]
2010-11-29 18:46 ` Eric Dumazet
2010-11-29 19:07 ` Eric Dumazet
2010-11-29 19:21 ` Eric Dumazet
2010-11-29 19:38 ` Stephen Hemminger
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=4CF3F114.2070108@oracle.com \
--to=john.haxby@oracle.com \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).