From: Roberto Nibali <ratz@drugphish.ch>
To: "joël Winteregg" <joel.winteregg@eivd.ch>
Cc: linux-kernel@vger.kernel.org, linux-net@vger.kernel.org
Subject: Re: client socket and source port selection
Date: Mon, 29 Nov 2004 23:32:46 +0100 [thread overview]
Message-ID: <41ABA38E.3010507@drugphish.ch> (raw)
In-Reply-To: <1101576123.744.31.camel@debian>
Hello,
> For the project i'm doing, i must know how the Linux kernel allocate
> sockets source port (from the dynamic range of the (2**16)-1 ports). I
> looked on the Web but it's really hard to find the algoritm of the
> source port allocation...
Check the source ;). There is a proc-fs entry which relates to the
source port range setting. Over this entry point you get in case of TCP
sockets to ../net/ipv4/tcp_ipv4.c:tcp_v4_get_port(...). For UDP sockets
you need to peek into ../net/ipv4/udp.c:udp_v4_get_port().
> Someone maybe know how it's work or if there is a paper on the web that
> explain this source port selection ?
Not likely, but reading the source should help. You can set the local
port range via /proc/sys/net/ipv4/ip_local_port_range. It's documented.
HTH and best regards,
Roberto Nibali, ratz
--
echo
'[q]sa[ln0=aln256%Pln256/snlbx]sb3135071790101768542287578439snlbxq' | dc
prev parent reply other threads:[~2004-11-29 22:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-27 17:22 client socket and source port selection joël Winteregg
2004-11-27 19:39 ` Jan Engelhardt
2004-11-29 22:32 ` Roberto Nibali [this message]
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=41ABA38E.3010507@drugphish.ch \
--to=ratz@drugphish.ch \
--cc=joel.winteregg@eivd.ch \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-net@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.