Messages in this thread | | | Subject | Re: [FIX] Re: connect() occasionally succeeds improperly to localhost port 1024-4999 | Date | Mon, 30 Aug 1999 11:34:31 -0700 | From | Craig Milo Rogers <> |
| |
>> 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 majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |