[lkml]   [1999]   [Aug]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [FIX] Re: connect() occasionally succeeds improperly to localhost port 1024-4999
>> 	This involves a trivial change to
>> ipv4/tcp_ipv4/tcp_v4_get_port() in linux-2.2.12 and linux-2.3.15.
>> In the rover loop, before the "break;", add:
>> if (sk->dport == rover) goto next;
>I don't believe it is quite this simple, since sk->dport isn't initialized
>until after the tcp_v4_get_port call. inet_stream_connect() calls
>inet_autobind() early on. The latter immediately calls tcp_v4_get_port()
>for this type of socket. Perhaps sk->dport could be initialized at the
>beginning of inet_stream_connect()? I am not familiar enough with the
>kernel to judge the side effects of such a move.

Well, clearly I'm not so familiar with the code, either; I
should have examined the code paths more thoroughly... I'd say that
the simplest thing to do is to move the sk->dport and sk->daddr
assignments in itcp_ipv4.c up 22 lines, between the sk->rcv_saddr
assignment and the if (!sk->num) {.

I don't see inet_stream_connect() calling inet_autobind() in
linux-2.3.15/net/ipve/af_inet.c. However, inet_dgram_connect(),
inet_recvmsg(), and inet_sendmsg() all call inet_autobind(), and these
call sites also need review and possible change.

Craig Milo Rogers

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:53    [W:0.039 / U:0.020 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site