summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2000-05-31 03:09:23 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2000-05-31 03:09:23 +0000
commit0fbdba2556ddd1c73b98d76a080a79b1da61a2e0 (patch)
tree3299bd3d46cc47f3405e6485a0d8cbc5bceb2d17
parentc6e9070e8a4c013201077b5b364b4424631156d0 (diff)
sync with the latest kame code. insufficient len in malloc() call is
corrected.
-rw-r--r--usr.sbin/faithd/README4
-rw-r--r--usr.sbin/faithd/faithd.863
-rw-r--r--usr.sbin/faithd/faithd.c17
-rw-r--r--usr.sbin/faithd/faithd.h7
-rw-r--r--usr.sbin/faithd/ftp.c17
-rw-r--r--usr.sbin/faithd/rsh.c7
-rw-r--r--usr.sbin/faithd/tcp.c7
7 files changed, 62 insertions, 60 deletions
diff --git a/usr.sbin/faithd/README b/usr.sbin/faithd/README
index 34b66b27d42..b8c770f7d6c 100644
--- a/usr.sbin/faithd/README
+++ b/usr.sbin/faithd/README
@@ -1,8 +1,8 @@
Configuring FAITH IPv6-to-IPv4 TCP relay
Kazu Yamamoto and Jun-ichiro itojun Hagino
-$OpenBSD: README,v 1.4 2000/02/25 10:24:10 itojun Exp $
-KAME Id: README,v 1.2 1999/12/21 01:37:06 itojun Exp
+$OpenBSD: README,v 1.5 2000/05/31 03:09:21 itojun Exp $
+$KAME: README,v 1.3 2000/05/31 03:08:04 itojun Exp $
Introduction
diff --git a/usr.sbin/faithd/faithd.8 b/usr.sbin/faithd/faithd.8
index 35673944e87..13de51cc659 100644
--- a/usr.sbin/faithd/faithd.8
+++ b/usr.sbin/faithd/faithd.8
@@ -1,4 +1,5 @@
-.\" $OpenBSD: faithd.8,v 1.5 2000/04/12 21:47:52 aaron Exp $
+.\" $OpenBSD: faithd.8,v 1.6 2000/05/31 03:09:22 itojun Exp $
+.\" $KAME: faithd.8,v 1.9 2000/05/31 03:06:07 itojun Exp $
.\"
.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
.\" All rights reserved.
@@ -27,8 +28,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" KAME Id: faithd.8,v 1.6 2000/03/12 16:49:34 itojun Exp
-.\"
.Dd May 17, 1998
.Dt FAITHD 8
.Os
@@ -36,15 +35,9 @@
.Nm faithd
.Nd FAITH IPv6/v4 translator daemon
.Sh SYNOPSIS
-.Nm faithd
+.Nm
.Op Fl dp
-.Oo
-.Ar service
-.Oo
-.Ar serverpath
-.Op Ar serverargs
-.Oc
-.Oc
+.Op Ar service Op Ar serverpath Op Ar serverargs
.Sh DESCRIPTION
.Nm
provides IPv6/v4 TCP relay for the specified
@@ -53,7 +46,9 @@ provides IPv6/v4 TCP relay for the specified
.Nm
must be invoked on IPv4/v6 dual stack router.
The router must be configured to capture all the TCP traffic
-toward reserved IPv6 address prefix, by using
+toward reserved
+.Tn IPv6
+address prefix, by using
.Xr route 8
and
.Xr sysctl 8
@@ -62,20 +57,32 @@ commands.
will daemonize itself on invocation.
.Pp
.Nm
-will listen to TCPv6 port
+will listen to
+.Tn TCPv6
+port
.Ar service .
-If TCPv6 traffic to port
+If
+.Tn TCPv6
+traffic to port
.Ar service
is found,
.Nm
-will relay the TCPv6 traffic to TCPv4.
-Destination for relayed TCPv4 connection will be determined by the
-last 4 octets of the original IPv6 destination.
+will relay the
+.Tn TCPv6
+traffic to
+.Tn TCPv4 .
+Destination for relayed
+.Tn TCPv4
+connection will be determined by the last 4 octets of the original
+.Tn IPv6
+destination.
For example, if
.Li 3ffe:0501:4819:ffff::
is reserved for
-.Nm faithd ,
-and the TCPv6 destination address is
+.Nm Ns ,
+and the
+.Tn TCPv6
+destination address is
.Li 3ffe:0501:4819:ffff::0a01:0101 ,
the traffic will be relayed to IPv4 destination
.Li 10.1.1.1 .
@@ -107,7 +114,7 @@ or other standard mechanisms.
By specifying
.Ar serverpath
to
-.Nm faithd ,
+.Nm Ns ,
you can run local daemons on the router.
.Nm
will invoke local daemon at
@@ -178,13 +185,10 @@ on client.
Inactive sessions will be disconnected in 30 minutes,
to avoid stale sessions from chewing up resources.
This may be inappropriate for some of the services
-.Po
-should this be configurable?
-.Pc .
-.\"
+.Pq should this be configurable? .
.Sh EXAMPLES
Before invoking
-.Nm faithd ,
+.Nm Ns ,
.Xr faith 4
interface has to be configured properly.
.Pp
@@ -218,7 +222,6 @@ Here are some other examples:
# faithd shell /usr/libexec/rshd rshd
# faithd sshd
.Ed
-.\"
.Sh RETURN VALUES
.Nm
exits with
@@ -228,7 +231,6 @@ on success, and
.Dv EXIT_FAILURE
.Pq 1
on error.
-.\"
.Sh SEE ALSO
.Xr faith 4 ,
.Xr route 8 ,
@@ -238,18 +240,15 @@ on error.
.%A Kazu Yamamoto
.%T "An IPv6-to-IPv4 transport relay translator"
.%R internet draft
-.%N draft-ietf-ngtrans-tcpudp-relay-00.txt
+.%N draft-ietf-ngtrans-tcpudp-relay-01.txt
.%O work in progress material
.Re
-.\"
.Sh SECURITY NOTICE
It is very insecure to use
.Xr rhosts 5
and other IP-address based authentication, for connections relayed by
.Nm
-.Po
-and any other TCP relaying services
-.Pc .
+.Pq and any other TCP relaying services .
.Pp
.Nm
itself does not implement access controls, as
diff --git a/usr.sbin/faithd/faithd.c b/usr.sbin/faithd/faithd.c
index 7b5bbbd626c..9429e19b26d 100644
--- a/usr.sbin/faithd/faithd.c
+++ b/usr.sbin/faithd/faithd.c
@@ -1,9 +1,10 @@
-/* $OpenBSD: faithd.c,v 1.4 2000/02/25 10:25:46 itojun Exp $ */
+/* $OpenBSD: faithd.c,v 1.5 2000/05/31 03:09:22 itojun Exp $ */
+/* $KAME: faithd.c,v 1.18 2000/05/31 03:06:07 itojun Exp $ */
/*
* Copyright (C) 1997 and 1998 WIDE Project.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -15,7 +16,7 @@
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -131,8 +132,6 @@ main(int argc, char *argv[])
#ifdef FAITH_NS
char *ns;
#endif /* FAITH_NS */
- extern int optind;
- extern char *optarg;
/*
* Initializing stuff
@@ -202,10 +201,10 @@ main(int argc, char *argv[])
if (serverargc > MAXARGV)
exit_error("too many augments");
- serverpath = malloc(strlen(argv[NUMPRG]));
+ serverpath = malloc(strlen(argv[NUMPRG]) + 1);
strcpy(serverpath, argv[NUMPRG]);
for (i = 0; i < serverargc; i++) {
- serverarg[i] = malloc(strlen(argv[i + NUMARG]));
+ serverarg[i] = malloc(strlen(argv[i + NUMARG]) + 1);
strcpy(serverarg[i], argv[i + NUMARG]);
}
serverarg[i] = NULL;
@@ -225,7 +224,7 @@ main(int argc, char *argv[])
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = 0;
error = getaddrinfo(NULL, service, &hints, &res);
- if (error)
+ if (error)
exit_error("getaddrinfo: %s", gai_strerror(error));
s_wld = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
@@ -358,7 +357,7 @@ again:
static void
play_child(int s_src, struct sockaddr *srcaddr)
{
- struct sockaddr_storage dstaddr6;
+ struct sockaddr_storage dstaddr6;
struct sockaddr_storage dstaddr4;
char src[MAXHOSTNAMELEN];
char dst6[MAXHOSTNAMELEN];
diff --git a/usr.sbin/faithd/faithd.h b/usr.sbin/faithd/faithd.h
index 52c05df7380..829dbac0f12 100644
--- a/usr.sbin/faithd/faithd.h
+++ b/usr.sbin/faithd/faithd.h
@@ -1,9 +1,10 @@
-/* $OpenBSD: faithd.h,v 1.2 1999/12/20 16:32:53 itojun Exp $ */
+/* $OpenBSD: faithd.h,v 1.3 2000/05/31 03:09:22 itojun Exp $ */
+/* $KAME: faithd.h,v 1.2 2000/05/31 03:06:07 itojun Exp $ */
/*
* Copyright (C) 1997 and 1998 WIDE Project.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -15,7 +16,7 @@
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
diff --git a/usr.sbin/faithd/ftp.c b/usr.sbin/faithd/ftp.c
index 28eced1b716..83c2511768d 100644
--- a/usr.sbin/faithd/ftp.c
+++ b/usr.sbin/faithd/ftp.c
@@ -1,9 +1,10 @@
-/* $OpenBSD: ftp.c,v 1.2 1999/12/20 16:32:53 itojun Exp $ */
+/* $OpenBSD: ftp.c,v 1.3 2000/05/31 03:09:22 itojun Exp $ */
+/* $KAME: ftp.c,v 1.7 2000/05/31 03:06:07 itojun Exp $ */
/*
* Copyright (C) 1997 and 1998 WIDE Project.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -15,7 +16,7 @@
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -555,10 +556,10 @@ passivefail:
p = (char *)&sin6->sin6_port;
n = snprintf(sbuf, sizeof(sbuf),
"228 Entering Long Passive Mode (%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)\r\n",
- 6, 16, UC(a[0]), UC(a[1]), UC(a[2]), UC(a[3]),
- UC(a[4]), UC(a[5]), UC(a[6]), UC(a[7]),
- UC(a[8]), UC(a[9]), UC(a[10]), UC(a[11]),
- UC(a[12]), UC(a[13]), UC(a[14]), UC(a[15]),
+ 6, 16, UC(a[0]), UC(a[1]), UC(a[2]), UC(a[3]),
+ UC(a[4]), UC(a[5]), UC(a[6]), UC(a[7]),
+ UC(a[8]), UC(a[9]), UC(a[10]), UC(a[11]),
+ UC(a[12]), UC(a[13]), UC(a[14]), UC(a[15]),
2, UC(p[0]), UC(p[1]));
write(dst, sbuf, n);
passivemode = 1;
@@ -676,7 +677,7 @@ passivefail2:
p = (char *)&sin->sin_port;
n = snprintf(sbuf, sizeof(sbuf),
"227 Entering Passive Mode (%d,%d,%d,%d,%d,%d)\r\n",
- UC(a[0]), UC(a[1]), UC(a[2]), UC(a[3]),
+ UC(a[0]), UC(a[1]), UC(a[2]), UC(a[3]),
UC(p[0]), UC(p[1]));
write(dst, sbuf, n);
passivemode = 1;
diff --git a/usr.sbin/faithd/rsh.c b/usr.sbin/faithd/rsh.c
index 83157419c13..3603e2d5577 100644
--- a/usr.sbin/faithd/rsh.c
+++ b/usr.sbin/faithd/rsh.c
@@ -1,9 +1,10 @@
-/* $OpenBSD: rsh.c,v 1.2 1999/12/20 16:32:53 itojun Exp $ */
+/* $OpenBSD: rsh.c,v 1.3 2000/05/31 03:09:22 itojun Exp $ */
+/* $KAME: rsh.c,v 1.3 2000/05/31 03:06:07 itojun Exp $ */
/*
* Copyright (C) 1997 and 1998 WIDE Project.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -15,7 +16,7 @@
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
diff --git a/usr.sbin/faithd/tcp.c b/usr.sbin/faithd/tcp.c
index 6b486a69d5b..c009260652e 100644
--- a/usr.sbin/faithd/tcp.c
+++ b/usr.sbin/faithd/tcp.c
@@ -1,9 +1,10 @@
-/* $OpenBSD: tcp.c,v 1.2 1999/12/20 16:32:53 itojun Exp $ */
+/* $OpenBSD: tcp.c,v 1.3 2000/05/31 03:09:22 itojun Exp $ */
+/* $KAME: tcp.c,v 1.2 2000/05/31 03:06:07 itojun Exp $ */
/*
* Copyright (C) 1997 and 1998 WIDE Project.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -15,7 +16,7 @@
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE