stun/stun.patch

Tue, 28 Aug 2012 18:36:35 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 28 Aug 2012 18:36:35 +0200
changeset 579
6b18bb69901e
parent 417
76ceb617f880
permissions
-rw-r--r--

Correct the paths of patched scripts, refine password generation,
mitigate fdatasync(2) detection problems, correct dependencies, remove
outdated autoconf components, correct conf file paths and attributes,
complete and correct log file rotation handing, and note warnings
useful for diagnosing builds.

michael@52 1 Index: server.cxx
michael@418 2 diff -Nau server.cxx.orig server.cxx
michael@52 3 --- server.cxx.orig 2005-08-13 22:19:29 +0200
michael@52 4 +++ server.cxx 2005-11-16 10:33:51 +0100
michael@418 5 @@ -2,6 +2,7 @@
michael@418 6 #include <cstring>
michael@418 7 #include <iostream>
michael@418 8 #include <cstdlib>
michael@418 9 +#include <cstdio>
michael@418 10
michael@418 11 #ifndef WIN32
michael@418 12 #include <sys/time.h>
michael@418 13 @@ -23,7 +24,7 @@
michael@52 14 usage()
michael@52 15 {
michael@52 16 cerr << "Usage: " << endl
michael@52 17 - << " ./server [-v] [-h] [-h IP_Address] [-a IP_Address] [-p port] [-o port] [-m mediaport]" << endl
michael@52 18 + << " ./server [-v] [-h] [-h IP_Address] [-a IP_Address] [-p port] [-o port] [-b] [-m mediaport] [-P pidfile]" << endl
michael@52 19 << " " << endl
michael@52 20 << " If the IP addresses of your NIC are 10.0.1.150 and 10.0.1.151, run this program with" << endl
michael@52 21 << " ./server -v -h 10.0.1.150 -a 10.0.1.151" << endl
michael@418 22 @@ -32,7 +33,7 @@
michael@52 23 << " -a sets the secondary IP" << endl
michael@52 24 << " -p sets the primary port and defaults to 3478" << endl
michael@52 25 << " -o sets the secondary port and defaults to 3479" << endl
michael@52 26 - << " -b makes the program run in the backgroud" << endl
michael@52 27 + << " -b makes the program run in the background" << endl
michael@52 28 << " -m sets up a STERN server starting at port m" << endl
michael@52 29 << " -v runs in verbose mode" << endl
michael@52 30 // in makefile too
michael@418 31 @@ -55,6 +56,7 @@
michael@52 32 StunAddress4 altAddr;
michael@52 33 bool verbose=false;
michael@52 34 bool background=false;
michael@52 35 + char *myPidFile = 0;
michael@52 36
michael@52 37 myAddr.addr = 0;
michael@52 38 altAddr.addr = 0;
michael@418 39 @@ -135,6 +137,16 @@
michael@52 40 }
michael@52 41 myMediaPort = UInt16(strtol( argv[arg], NULL, 10));
michael@52 42 }
michael@52 43 + else if ( !strcmp( argv[arg] , "-P" ) )
michael@52 44 + {
michael@52 45 + arg++;
michael@52 46 + if ( argc <= arg )
michael@52 47 + {
michael@52 48 + usage();
michael@52 49 + exit(-1);
michael@52 50 + }
michael@52 51 + myPidFile = argv[arg];
michael@52 52 + }
michael@52 53 else
michael@52 54 {
michael@52 55 usage();
michael@418 56 @@ -213,6 +225,19 @@
michael@52 57
michael@52 58 if (pid == 0) //child or not using background
michael@52 59 {
michael@52 60 + /* write a daemon pidfile */
michael@52 61 + if (myPidFile) {
michael@52 62 + pid_t pid;
michael@52 63 + FILE *fp;
michael@52 64 + pid = getpid();
michael@52 65 + if ((fp = fopen(myPidFile, "w")) == NULL) {
michael@52 66 + fprintf(stderr, "stund: Can't write pidfile '%s'", myPidFile);
michael@52 67 + exit(1);
michael@52 68 + }
michael@52 69 + fprintf(fp, "%ld\n", (long)pid);
michael@52 70 + fclose(fp);
michael@52 71 + }
michael@52 72 +
michael@52 73 StunServerInfo info;
michael@52 74 bool ok = stunInitServer(info, myAddr, altAddr, myMediaPort, verbose);
michael@52 75
michael@53 76 Index: stun.cxx
michael@418 77 diff -Nau stun.cxx.orig stun.cxx
michael@53 78 --- stun.cxx.orig 2005-08-14 02:39:03.000000000 +0200
michael@53 79 +++ stun.cxx 2009-01-09 00:23:08.069498590 +0100
michael@418 80 @@ -16,6 +16,9 @@
michael@53 81 #include <string.h>
michael@53 82 #include <sys/ioctl.h>
michael@53 83 #include <sys/socket.h>
michael@418 84 +#if defined (__SVR4) && defined (__sun)
michael@53 85 +#include <sys/sockio.h>
michael@418 86 +#endif
michael@53 87 #include <sys/time.h>
michael@53 88 #include <sys/types.h>
michael@53 89 #include <arpa/inet.h>

mercurial