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 -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html