- To: slug@xxxxxxxxxxx
- Subject: Re: [SLUG] kernel code for client ephemeral port allocation?
- From: Sonia Hamilton <sonia@xxxxxxxxxxxx>
- Date: Tue, 08 Apr 2008 14:54:13 +1000
Thanks! S.
On Tue, 2008-04-08 at 08:13 +1000, Erik de Castro Lopo wrote:
> Sonia Hamilton wrote:
>
> > When a tcp (or udp) connection is setup, the client is allocated a
> > source port - a so-called ephemeral port (this can be seen in the Local
> > Address column of netstat).
> >
> > Out of interest, I wouldn't mind looking at the code that
> > pseudo-randomly allocates this port number. Can anyone point me in the
> > direction of the directory (or even file) I should look at? I'm not
> > very familiar with the layout of the kernel code.
>
> LXR (Linux Cross Reference) is a really good resource:
>
> http://lxr.linux.no/linux
>
> Searching for ephemeral results in (among others):
>
> http://lxr.linux.no/linux/drivers/char/random.c#L1567
>
> which I think may be what you are looking for.
>
> The hard way to do this of course would be just grab an unzip a source
> code tarball, cd into it and then:
>
> grep -r ephemeral .
>
> and see where that leads you.
>
> Have fun :-).
>
> Erik
> --
> -----------------------------------------------------------------
> Erik de Castro Lopo
> -----------------------------------------------------------------
> "The question of whether a computer can think is no more interesting
> than the question of whether a submarine can swim." -- edsger dijkstra
--
Thanks,
Sonia Hamilton
http://soniahamilton.wordpress.com
http://www.linkedin.com/in/soniahamilton