stun/stun.patch

Fri, 13 Apr 2012 17:49:04 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 13 Apr 2012 17:49:04 +0200
changeset 417
76ceb617f880
parent 53
11a94c8e617e
child 418
680c3f7768b0
permissions
-rw-r--r--

Update to latest (although not new) upstream vendor version.

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

mercurial