* client socket and source port selection
@ 2004-11-27 17:22 joël Winteregg
2004-11-27 19:39 ` Jan Engelhardt
2004-11-29 22:32 ` Roberto Nibali
0 siblings, 2 replies; 3+ messages in thread
From: joël Winteregg @ 2004-11-27 17:22 UTC (permalink / raw)
To: linux-kernel
HI,
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...
Someone maybe know how it's work or if there is a paper on the web that
explain this source port selection ?
Thanks a lot for your help !
Joël.W
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: client socket and source port selection
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
1 sibling, 0 replies; 3+ messages in thread
From: Jan Engelhardt @ 2004-11-27 19:39 UTC (permalink / raw)
To: joël Winteregg; +Cc: linux-kernel
>HI,
>
>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...
>
>Someone maybe know how it's work or if there is a paper on the web that
>explain this source port selection ?
I think it starts at 1024 when it boots, and increments whenever a socket is
created.
Jan Engelhardt
--
Gesellschaft für Wissenschaftliche Datenverarbeitung
Am Fassberg, 37077 Göttingen, www.gwdg.de
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: client socket and source port selection
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
1 sibling, 0 replies; 3+ messages in thread
From: Roberto Nibali @ 2004-11-29 22:32 UTC (permalink / raw)
To: joël Winteregg; +Cc: linux-kernel, linux-net
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-11-29 22:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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.