chiark / gitweb /
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 e3e834250995eeb3b0e0bf7c35aa992a2333a1a8..1a9e12e3f65e8b7547ab573e921ead622bf7f506 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 1fc151184accd68059cd50a923e943fbfd087edc..88de6307889e53b900c8a7b1c02c0ef1d82bbcc3 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 8f87cf6ebd2dabe0736a936f4eb3c1f68dbfc597..810069df39ed339ac046d761a59c3830a684f2b9 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 7fb59c3e0d70630aa2fd691a5a555fdb8e20212d..968400e70495f8f98f6da154f43db353b67702ba 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 b287673a9344b486f89168705dd81dbc24159f8d..52df1d0c206176dfd035dee0a959b50c5677e62e 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 8105a2a1525e116f1228fda4d8e8abf9b66d24e1..19f061bf9ce4b64e1c534552c243499db5e77983 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 4d0472a6a7c56e82c93d341fea011309683da8d4..912f7d0b52790437fb85a3b13be0735ce2310051 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 ecf222fd8d11cf53c3b33e981b66d9fa6bdb81f5..55ed82b3eedde575cf6fbc15467ceae05bd72ef8 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 670e14101924339888de1eb5066afff0b26a3dba..f46e232cb4d9b0da910ca12564a28aa787dcff5d 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 3db1cb965faf8a15aa824c0f9210644c62b0bc27..cc8a4e6f569e74e201766e2ce44f63352de4fc57 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 798ccd9e820d415e9442862913fb357436f669db..e3daae7c96de048cd19cf05d7d37b61653592d97 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)