1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/stun/stun.patch Fri Jan 09 00:45:56 2009 +0100 1.3 @@ -0,0 +1,85 @@ 1.4 +Index: client.cxx 1.5 +--- client.cxx.orig 2005-08-14 02:43:10 +0200 1.6 ++++ client.cxx 2005-11-16 10:28:17 +0100 1.7 +@@ -178,13 +178,13 @@ 1.8 + retval[nic] = 0x02; 1.9 + break; 1.10 + case StunTypeDependentFilter: 1.11 +- cout << "Independedt Mapping, Address Dependendent Filter"; 1.12 ++ cout << "Independedt Mapping, Address Dependent Filter"; 1.13 + if ( presPort ) cout << ", preserves ports"; else cout << ", random port"; 1.14 + if ( hairpin ) cout << ", will hairpin"; else cout << ", no hairpin"; 1.15 + retval[nic] = 0x04; 1.16 + break; 1.17 + case StunTypePortDependedFilter: 1.18 +- cout << "Indepndent Mapping, Port Dependent Filter"; 1.19 ++ cout << "Independent Mapping, Port Dependent Filter"; 1.20 + if ( presPort ) cout << ", preserves ports"; else cout << ", random port"; 1.21 + if ( hairpin ) cout << ", will hairpin"; else cout << ", no hairpin"; 1.22 + retval[nic] = 0x06; 1.23 +Index: server.cxx 1.24 +--- server.cxx.orig 2005-08-13 22:19:29 +0200 1.25 ++++ server.cxx 2005-11-16 10:33:51 +0100 1.26 +@@ -23,7 +23,7 @@ 1.27 + usage() 1.28 + { 1.29 + cerr << "Usage: " << endl 1.30 +- << " ./server [-v] [-h] [-h IP_Address] [-a IP_Address] [-p port] [-o port] [-m mediaport]" << endl 1.31 ++ << " ./server [-v] [-h] [-h IP_Address] [-a IP_Address] [-p port] [-o port] [-b] [-m mediaport] [-P pidfile]" << endl 1.32 + << " " << endl 1.33 + << " If the IP addresses of your NIC are 10.0.1.150 and 10.0.1.151, run this program with" << endl 1.34 + << " ./server -v -h 10.0.1.150 -a 10.0.1.151" << endl 1.35 +@@ -32,7 +32,7 @@ 1.36 + << " -a sets the secondary IP" << endl 1.37 + << " -p sets the primary port and defaults to 3478" << endl 1.38 + << " -o sets the secondary port and defaults to 3479" << endl 1.39 +- << " -b makes the program run in the backgroud" << endl 1.40 ++ << " -b makes the program run in the background" << endl 1.41 + << " -m sets up a STERN server starting at port m" << endl 1.42 + << " -v runs in verbose mode" << endl 1.43 + // in makefile too 1.44 +@@ -55,6 +55,7 @@ 1.45 + StunAddress4 altAddr; 1.46 + bool verbose=false; 1.47 + bool background=false; 1.48 ++ char *myPidFile = 0; 1.49 + 1.50 + myAddr.addr = 0; 1.51 + altAddr.addr = 0; 1.52 +@@ -135,6 +136,16 @@ 1.53 + } 1.54 + myMediaPort = UInt16(strtol( argv[arg], NULL, 10)); 1.55 + } 1.56 ++ else if ( !strcmp( argv[arg] , "-P" ) ) 1.57 ++ { 1.58 ++ arg++; 1.59 ++ if ( argc <= arg ) 1.60 ++ { 1.61 ++ usage(); 1.62 ++ exit(-1); 1.63 ++ } 1.64 ++ myPidFile = argv[arg]; 1.65 ++ } 1.66 + else 1.67 + { 1.68 + usage(); 1.69 +@@ -213,6 +224,19 @@ 1.70 + 1.71 + if (pid == 0) //child or not using background 1.72 + { 1.73 ++ /* write a daemon pidfile */ 1.74 ++ if (myPidFile) { 1.75 ++ pid_t pid; 1.76 ++ FILE *fp; 1.77 ++ pid = getpid(); 1.78 ++ if ((fp = fopen(myPidFile, "w")) == NULL) { 1.79 ++ fprintf(stderr, "stund: Can't write pidfile '%s'", myPidFile); 1.80 ++ exit(1); 1.81 ++ } 1.82 ++ fprintf(fp, "%ld\n", (long)pid); 1.83 ++ fclose(fp); 1.84 ++ } 1.85 ++ 1.86 + StunServerInfo info; 1.87 + bool ok = stunInitServer(info, myAddr, altAddr, myMediaPort, verbose); 1.88 +