Use the new official IANA-allocated port number 4070.
authorMark Wooding <mdw@distorted.org.uk>
Wed, 11 Jul 2007 22:21:17 +0000 (23:21 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Wed, 11 Jul 2007 22:21:48 +0000 (23:21 +0100)
This is now the default port selected by the server (say -p0 for
explicit dynamic allocation).  Also let the ADDR command default to 4070
so that nobody needs to remember it.

README
common/protocol.h
debian/tripe.README
doc/tripe-admin.5.in
doc/tripe.8.in
init/tripe.conf
mon/tripemon.in
server/admin.c
server/tripe.c
server/tripe.h
wireshark/packet-tripe.c

diff --git a/README b/README
index e3e8342..1a9e12e 100644 (file)
--- a/README
+++ b/README
@@ -45,7 +45,7 @@ Installation notes
                #! /bin/sh
 
                set -e
-               tripectl add PEER PEER-ADDR 22003
+               tripectl add PEER PEER-ADDR 4070
                ifname=`tripectl ifname PEER`
                ifconfig $ifname LOCAL pointopoint REMOTE mtu 1429
                route add -net RNET netmask RMASK gw REMOTE
index 1fc1511..88de630 100644 (file)
@@ -31,6 +31,8 @@
 
 /*----- TrIPE protocol ----------------------------------------------------*/
 
+#define TRIPE_PORT 4070                        /* Assigned by IANA */
+
 /* --- TrIPE message format --- *
  *
  * A packet begins with a single-byte message type.  The top four bits are a
index 8f87cf6..810069d 100644 (file)
@@ -40,7 +40,7 @@ SETTING UP TRIPE FOR DEBIAN GNU/LINUX
 
          PEER=...              # The peer's name
          PEERADDR=...          # Peer's publicly-routable address
-         PEERPORT=22003        # Port peer is listening on
+         PEERPORT=4070         # Port peer is listening on
          LOCAL=...             # My address for point-to-point
          REMOTE=...            # His address for point-to-point
          RNET=...              # Remote network address
index 7fb59c3..968400e 100644 (file)
@@ -215,12 +215,13 @@ are always in upper-case.
 .PP
 At present, only one address family is understood.
 .TP
-.BI "INET " address " " port
+.BI "INET " address " \fR[" port \fR]
 An Internet socket, naming an IPv4 address and UDP port.  On output, the
 address is always in numeric dotted-quad form, and the port is given as
 a plain number.  On input, DNS hostnames and symbolic port names are
-permitted.  Name resolution does not block the main server, but will
-block the requesting client, unless the command is run in the background.
+permitted; if omitted, the default port 4070 is used.  Name resolution
+does not block the main server, but will block the requesting client,
+unless the command is run in the background.
 .PP
 If, on input, no recognised address family token is found, the following
 words are assumed to represent an
index b287673..52df1d0 100644 (file)
@@ -364,18 +364,12 @@ Start the
 servers up.  Run
 .RS
 .VS
-tripectl \-slD \-S\-p22003
+tripectl \-slD
 .VE
 on each of
 .B alice
 and
 .BR bob .
-(The
-.RB ` \-p22003 '
-forces the server to use UDP port 22003: use some other number if 22003
-is inappropriate for your requirements.  I chose it by taking the first
-16 bits of the RIPEMD160 hash of
-.RB ` TrIPE '.
 .RE
 .hP 6.
 To get
@@ -387,7 +381,7 @@ run this shell script (or one like it):
 .VS
 #! /bin/sh
 
-tripectl add bob 200.0.2.1 22003
+tripectl add bob 200.0.2.1 4070
 ifname=`tripectl ifname bob`
 ifconfig $ifname 10.0.1.1 pointopoint 10.0.2.1
 route add -net \e
index 8105a2a..19f061b 100644 (file)
 # packets from the named address.  The latter is probably more useful.
 # addr=MYHOST
 
-# The UDP port you want tripe to use.  I've chosen 22003 which isn't reserved
-# in any way.  I chose it because it's the first two bytes of the RIPEMD-160
-# hash of the string `TrIPE'.  If you don't set a port, tripe gets the kernel
-# to choose a port it's not using right now, and you have to dig it out by
-# saying `tripectl port'.
-# port=22003
+# The UDP port you want tripe to use.  The default is 4070, which is
+# officially allocated by the IANA.  If you explicitly specify port 0
+# then tripe gets the kernel to choose a port it's not using right now,
+# and you have to dig it out by saying `tripectl port'.
+# port=4070
 
 # The tunnel device you want tripe to use.  The default is to use a system-
 # specific device, if there's one compiled in, or SLIP if not.
index 4d0472a..912f7d0 100644 (file)
@@ -966,7 +966,7 @@ class AddPeerDialog (MyDialog):
                                newlinep = True)
     me.e_port = table.labelled('Port',
                                ValidatingEntry(numericvalidate(0, 65535),
-                                               '22003',
+                                               '4070',
                                                5))
     me.c_keepalive = G.CheckButton('Keepalives')
     me.l_tunnel = table.labelled('Tunnel',
index ecf222f..55ed82b 100644 (file)
@@ -1059,21 +1059,25 @@ static void a_resolve(admin *a, admin_resop *r, const char *tag,
   r->addr = 0;
   r->func = func;
   if (mystrieq(av[i], "inet")) i++;
-  if (ac - i != 2) {
-    a_fail(a, "bad-addr-syntax", "[inet] ADDRESS PORT", A_END);
+  if (ac - i != 1 && ac - i != 2) {
+    a_fail(a, "bad-addr-syntax", "[inet] ADDRESS [PORT]", A_END);
     goto fail;
   }
   r->sa.sin.sin_family = AF_INET;
   r->sasz = sizeof(r->sa.sin);
   r->addr = xstrdup(av[i]);
-  pt = strtoul(av[i + 1], &p, 0);
-  if (*p) {
-    struct servent *s = getservbyname(av[i + 1], "udp");
-    if (!s) {
-      a_fail(a, "unknown-service", "%s", av[i + 1], A_END);
-      goto fail;
+  if (!av[i + i])
+    pt = TRIPE_PORT;
+  else {
+    pt = strtoul(av[i + 1], &p, 0);
+    if (*p) {
+      struct servent *s = getservbyname(av[i + 1], "udp");
+      if (!s) {
+       a_fail(a, "unknown-service", "%s", av[i + 1], A_END);
+       goto fail;
+      }
+      pt = ntohs(s->s_port);
     }
-    pt = ntohs(s->s_port);
   }
   if (pt == 0 || pt >= 65536) {
     a_fail(a, "invalid-port", "%lu", pt, A_END);
index 670e141..f46e232 100644 (file)
@@ -114,7 +114,8 @@ Options:\n\
 -D, --daemon           Run in the background.\n\
 -d, --directory=DIR    Switch to directory DIR [default " CONFIGDIR "].\n\
 -b, --bind-address=ADDR        Bind UDP socket to this IP ADDR.\n\
--p, --port=PORT                Select UDP port to listen to.\n\
+-p, --port=PORT                Select UDP port to listen to "
+       "[default " STR(TRIPE_PORT) "].\n\
 -n, --tunnel=TUNNEL    Seelect default tunnel driver.\n\
 -U, --setuid=USER      Set uid to USER after initialization.\n\
 -G, --setgid=GROUP     Set gid to GROUP after initialization.\n\
@@ -135,7 +136,7 @@ int main(int argc, char *argv[])
   const char *csock = SOCKETDIR "/tripesock";
   const char *dir = CONFIGDIR;
   const char *p;
-  unsigned port = 0;
+  unsigned port = TRIPE_PORT;
   struct in_addr baddr = { INADDR_ANY };
   unsigned f = 0;
   int i;
@@ -243,7 +244,7 @@ int main(int argc, char *argv[])
            die(EXIT_FAILURE, "unknown service name `%s'", optarg);
          i = ntohs(s->s_port);
        }
-       if (i == 0 || i >= 65536)
+       if (i >= 65536)
          die(EXIT_FAILURE, "bad port number %lu", i);
        port = i;
       } break;
index 3db1cb9..cc8a4e6 100644 (file)
@@ -73,6 +73,7 @@
 #include <mLib/env.h>
 #include <mLib/fdflags.h>
 #include <mLib/fwatch.h>
+#include <mLib/macros.h>
 #include <mLib/mdwopt.h>
 #include <mLib/quis.h>
 #include <mLib/report.h>
index 798ccd9..e3daae7 100644 (file)
@@ -468,7 +468,7 @@ void proto_reg_handoff_tripe(void)
   dissector_handle_t dh;
 
   dh = create_dissector_handle(dissect_tripe, proto_tripe);
-  dissector_add("udp.port", 22003, dh);
+  dissector_add("udp.port", TRIPE_PORT, dh);
 }
 
 G_MODULE_EXPORT void plugin_reg_handoff(void)