X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=rrqnet.c;h=efd7066b457cb2438d96f1246cc553ad152cc3ed;hb=2df8ce02843318715c59343b73e258d1c318febb;hp=27769c8e9343a686f9a76af33749bc3a26ca938d;hpb=3ea171c085b92fb6cf260dd3d33e8ef83ea0ba56;p=rrq%2Frrqnet.git diff --git a/rrqnet.c b/rrqnet.c index 27769c8..efd7066 100644 --- a/rrqnet.c +++ b/rrqnet.c @@ -574,6 +574,7 @@ static int parse_bits(char *bits,int max,struct Allowed *into) { // Formats: [/][:][=keyfile] // Formats: [/][=keyfile] // Formats: \[[/]\][:][=keyfile] +// Formats: hostname:port[=keyfile] static int parse_allowed(char *arg,struct Allowed *into) { static char buffer[10000]; int n = strlen( arg ); @@ -887,9 +888,9 @@ static void write_remote(unsigned char *buf, int n,struct Remote *r) { } memcpy( output, buf, n ); // Use the private buffer for delivery // Apply the TPG quirk - if ( tpg_quirk && ( n == 1470 ) ) { + if ( tpg_quirk && ( n > 1460 ) && ( n < 1478 ) ) { VERBOSE2OUT( "tpg quirk applied\n" ); - n += 8; // Add 8 "random" tag-along bytes + n = 1478; // Add some "random" tag-along bytes } if ( r->spec == 0 ) { if ( r->uaddr.in.sa_family == 0 ) { @@ -1309,10 +1310,10 @@ static void heartbeat(int fd) { // Tell how to use this program and exit with failure. static void usage(void) { fprintf( stderr, "Packet tunneling over UDP, multiple channels, " ); - fprintf( stderr, "version 0.2.5\n" ); + fprintf( stderr, "version 1.5.3\n" ); fprintf( stderr, "Usage: " ); fprintf( stderr, - "%s [-v] [-4] [-B n] [-T n] [-m mcast] [-t tap] port [remote]+ \n", + "%s [-v] [-tpg] [-4] [-B n] [-T n] [-m mcast] [-t tap] port [remote]+ \n", progname ); exit( 1 ); } @@ -1411,11 +1412,6 @@ int main(int argc, char *argv[]) { ///// Parse command line arguments i = 1; #define ENSUREARGS(n) if ( argc < i + n ) usage() - ENSUREARGS( 1 ); - if ( strncmp( "-tpg", argv[i], 4 ) == 0 ) { - tpg_quirk = 1; - i++; - } ENSUREARGS( 1 ); // First: optional -v, -vv or -vvv if ( strncmp( "-v", argv[i], 2 ) == 0 ) { @@ -1431,6 +1427,11 @@ int main(int argc, char *argv[]) { i++; ENSUREARGS( 1 ); } + if ( strncmp( "-tpg", argv[i], 4 ) == 0 ) { + tpg_quirk = 1; + i++; + ENSUREARGS( 1 ); + } // then: optional -4 if ( strncmp( "-4", argv[i], 2 ) == 0 ) { udp6 = 0; @@ -1473,7 +1474,7 @@ int main(int argc, char *argv[]) { } // then: required port if ( sscanf( argv[i++], "%d", &port ) != 1 ) { - fprintf( stderr, "Bad local port" ); + fprintf( stderr, "Bad local port: %s\n", argv[i-1] ); usage(); } // then: any number of allowed remotes