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.
- 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
ifname=`tripectl ifname PEER`
ifconfig $ifname LOCAL pointopoint REMOTE mtu 1429
route add -net RNET netmask RMASK gw REMOTE
/*----- TrIPE protocol ----------------------------------------------------*/
/*----- 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
/* --- TrIPE message format --- *
*
* A packet begins with a single-byte message type. The top four bits are a
PEER=... # The peer's name
PEERADDR=... # Peer's publicly-routable address
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
LOCAL=... # My address for point-to-point
REMOTE=... # His address for point-to-point
RNET=... # Remote network address
.PP
At present, only one address family is understood.
.TP
.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
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
.PP
If, on input, no recognised address family token is found, the following
words are assumed to represent an
-tripectl \-slD \-S\-p22003
.VE
on each of
.B alice
and
.BR bob .
.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 '.
-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
ifname=`tripectl ifname bob`
ifconfig $ifname 10.0.1.1 pointopoint 10.0.2.1
route add -net \e
# packets from the named address. The latter is probably more useful.
# addr=MYHOST
# 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.
# 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.
newlinep = True)
me.e_port = table.labelled('Port',
ValidatingEntry(numericvalidate(0, 65535),
newlinep = True)
me.e_port = table.labelled('Port',
ValidatingEntry(numericvalidate(0, 65535),
5))
me.c_keepalive = G.CheckButton('Keepalives')
me.l_tunnel = table.labelled('Tunnel',
5))
me.c_keepalive = G.CheckButton('Keepalives')
me.l_tunnel = table.labelled('Tunnel',
r->addr = 0;
r->func = func;
if (mystrieq(av[i], "inet")) i++;
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]);
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);
}
if (pt == 0 || pt >= 65536) {
a_fail(a, "invalid-port", "%lu", pt, A_END);
}
if (pt == 0 || pt >= 65536) {
a_fail(a, "invalid-port", "%lu", pt, A_END);
-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\
-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\
-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\
const char *csock = SOCKETDIR "/tripesock";
const char *dir = CONFIGDIR;
const char *p;
const char *csock = SOCKETDIR "/tripesock";
const char *dir = CONFIGDIR;
const char *p;
+ unsigned port = TRIPE_PORT;
struct in_addr baddr = { INADDR_ANY };
unsigned f = 0;
int i;
struct in_addr baddr = { INADDR_ANY };
unsigned f = 0;
int i;
die(EXIT_FAILURE, "unknown service name `%s'", optarg);
i = ntohs(s->s_port);
}
die(EXIT_FAILURE, "unknown service name `%s'", optarg);
i = ntohs(s->s_port);
}
- if (i == 0 || i >= 65536)
die(EXIT_FAILURE, "bad port number %lu", i);
port = i;
} break;
die(EXIT_FAILURE, "bad port number %lu", i);
port = i;
} break;
#include <mLib/env.h>
#include <mLib/fdflags.h>
#include <mLib/fwatch.h>
#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>
#include <mLib/mdwopt.h>
#include <mLib/quis.h>
#include <mLib/report.h>
dissector_handle_t dh;
dh = create_dissector_handle(dissect_tripe, proto_tripe);
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)
}
G_MODULE_EXPORT void plugin_reg_handoff(void)