tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Question about tcp ephemeral ports

Hi Eric,

> The code that actually picks the ephemeral port to use is in 
> netinet/rfc6056.c.
> At first glance, it looks like it *should* allow your code to work: regardless
> of the algorithm used to cycle through the port numbers, the 
> check_suitable_port() function uses the address to verify that the port is
> available.

I was working on the 5.1 source code that don't include the rfc6056
port randomization mechanism. I will have a try with latest source
code, but I think the behaviour of my test program will be the same
because the following code that does the implicit bind when doing a
connect is still present:

                if (inp->inp_lport == 0) {
                        error = in_pcbbind(inp, NULL, l);
                        if (error)

I suppose that this specific in_pcbbind() could be replaced by another
one -- a sort of in_pcbbind_before_connect() -- that is aware of the
address and port we are connecting to. I will try to implement this
idea and get back to the list with a first patch.


Home | Main Index | Thread Index | Old Index