Hi, I slighty modify the sources of COW so that -U couls be used with TCP mode. It is quite useful because of firewalling + Nat which prevent the use of TCP. I join the patch. I couldn't test it as much as I would have liked to, because I wasn't able to find an other server that accept unblessed client and was obliged to test it locally... -- Benjamin `Quisar' Lerman quisar at quisar.ambre.net http://www.ambre.net/quisar "Si les yeux pouvaient tuer et enfanter, les rues seraient pleines de cadavres et de femmes grosses." Valery -------------- next part -------------- Index: cowapi.h =================================================================== RCS file: /cvsroot/netrek/client/cow/cowapi.h,v retrieving revision 1.4 diff -u -r1.4 cowapi.h --- cowapi.h 2000/05/19 14:24:52 1.4 +++ cowapi.h 2001/04/26 10:38:22 @@ -70,7 +70,7 @@ extern char defpasswd[PSEUDOSIZE]; extern char login[PSEUDOSIZE]; -extern int baseUdpLocalPort; +extern int baseLocalPort; extern int log_packets; extern int ghoststart; Index: data.c =================================================================== RCS file: /cvsroot/netrek/client/cow/data.c,v retrieving revision 1.6 diff -u -r1.6 data.c --- data.c 2000/12/28 12:36:38 1.6 +++ data.c 2001/04/26 10:38:22 @@ -290,7 +290,7 @@ #endif /* for router-based firewalls, we need to tunnel through at a specific port */ -int baseUdpLocalPort = 0; /* UDP */ +int baseLocalPort = 0; /* UDP */ int debug = 0; Index: data.h =================================================================== RCS file: /cvsroot/netrek/client/cow/data.h,v retrieving revision 1.6 diff -u -r1.6 data.h --- data.h 2000/05/19 14:24:52 1.6 +++ data.h 2001/04/26 10:38:22 @@ -282,7 +282,7 @@ extern char *gw_mach; /* UDP */ #endif -extern int baseUdpLocalPort; /* UDP */ +extern int baseLocalPort; /* UDP and TCP */ extern int showTractorPressor; Index: defaults.c =================================================================== RCS file: /cvsroot/netrek/client/cow/defaults.c,v retrieving revision 1.3 diff -u -r1.3 defaults.c --- defaults.c 1999/08/05 16:46:32 1.3 +++ defaults.c 2001/04/26 10:38:23 @@ -691,7 +691,7 @@ tryUdp = booleanDefault("tryUdp", tryUdp); tryUdp1 = tryUdp; udpSequenceChk = booleanDefault("udpSequenceCheck", udpSequenceChk); - baseUdpLocalPort = intDefault("baseUdpLocalPort", baseUdpLocalPort); + baseLocalPort = intDefault("baseLocalPort", baseLocalPort); #ifdef SHORT_PACKETS tryShort = booleanDefault("tryShort", tryShort); Index: main.c =================================================================== RCS file: /cvsroot/netrek/client/cow/main.c,v retrieving revision 1.9 diff -u -r1.9 main.c --- main.c 2000/11/07 20:24:05 1.9 +++ main.c 2001/04/26 10:38:23 @@ -322,7 +322,7 @@ #endif case 'U': - if ((baseUdpLocalPort = atoi(*argv)) == 0) + if ((baseLocalPort = atoi(*argv)) == 0) { fprintf(stderr, "Error: -U requires a port number\n"); exit(1); @@ -521,7 +521,7 @@ printf(" [-H] specify host (via gateway)\n"); #endif - printf(" [-U udp_port] Specify client UDP port (useful for some firewalls)\n"); + printf(" [-U port] Specify client UDP or TCP port (useful for some firewalls)\n"); #ifdef RSA printf(" [-o] use old-style binary verification)\n"); Index: socket.c =================================================================== RCS file: /cvsroot/netrek/client/cow/socket.c,v retrieving revision 1.4 diff -u -r1.4 socket.c --- socket.c 1999/07/24 19:23:43 1.4 +++ socket.c 2001/04/26 10:38:24 @@ -2126,10 +2126,17 @@ int newsocket; struct socket_cpacket sockPack; - newsocket = (getpid() & 32767); + /* If baseLocalPort is defined we want to start from that */ + if(baseLocalPort) + newsocket = baseLocalPort; + else + newsocket = (getpid() & 32767); while (newsocket < 2048 || newsocket == old) { - newsocket = (newsocket + 10687) & 32767; + if(baseLocalPort) + newsocket++; + else + newsocket = (newsocket + 10687) & 32767; } sockPack.type = CP_SOCKET; sockPack.socket = htonl(newsocket); @@ -2836,11 +2843,11 @@ errno = 0; udpLocalPort = (getpid() & 32767) + (RANDOM() % 256); - /* if baseUdpLocalPort is defined, we want to start from that */ - if (baseUdpLocalPort) + /* if baseLocalPort is defined, we want to start from that */ + if (baseLocalPort) { - udpLocalPort = baseUdpLocalPort; - UDPDIAG(("using base port %d\n", baseUdpLocalPort)); + udpLocalPort = baseLocalPort; + UDPDIAG(("using base port %d\n", baseLocalPort)); } for (attempts = 0; attempts < MAX_PORT_RETRY; attempts++) @@ -2867,7 +2874,7 @@ * * * router-based firewall, we just increment; otherwise we try to mix * it * * up a little. The check for ports < 2048 is done above. */ - if (baseUdpLocalPort) + if (baseLocalPort) udpLocalPort++; else udpLocalPort = (udpLocalPort + 10687) & 32767;