Re: Linux 2.1.xxx TCP bug

Andi Kleen (ak@muc.de)
Sat, 12 Dec 1998 14:56:11 +0100


In muc.lists.linux-kernel, you wrote:
>jync> There seems to be a major TCP bug probably in the masquerading code. This
>jync> bug also occurs intermittently in the 2.0 kernels, but 2.0 usually manages
>jync> to recover in time, though the bug when it occurs is even worse.
>[...]
>jync> # autofw for ICQ
>jync> /usr/sbin/ipmasqadm autofw -A -r tcp 2001 2050 -h 172.31.13.2
>jync> /usr/sbin/ipmasqadm autofw -A -r tcp 2051 2100 -h 172.31.13.3
>
>Seen this, solved this.
>
>This is a fundamental problem with current ipautofw implementation when
>forwarding a range of ports.
>It uses the port range itself and if the port range intersects with the
>range used by kerenle itself for local ports of outgoing connections.
>And when the kernel reaches the forwarded port range the connctions just
>fail woth timeout. When the range is over, it works just fine.
>
>The deeper reason is that there's no neat way to tell the port
>allocating code to not use specific ranges.

There is, just bind them (error checking omitted/untested):

/* Only works when the range is < NR_OPEN-3 */

for (i = start_port_range; i <= end_port_range; i++) {
struct sockaddr_in sin;
int sk = socket(PF_INET,SOCK_STREAM,0);
sin.sin_family = AF_INET;
sin.sin_port = htons(i);
sin.sin_addr.s_addr = INADDR_ANY;
bind(sk, &sin, sizeof sin);
}
pause(); /* until someone kills us */

Then keep that program running.

-Andi

-
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/