Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/inetd add faithd(8) support. with "faith/tcp6" pro...



details:   https://anonhg.NetBSD.org/src/rev/f7c7ff64969f
branches:  trunk
changeset: 494243:f7c7ff64969f
user:      itojun <itojun%NetBSD.org@localhost>
date:      Tue Jul 04 13:25:39 2000 +0000

description:
add faithd(8) support.  with "faith/tcp6" protocol specification,
it will open a socket with setsockopt(IPV6_FAITH).

diffstat:

 usr.sbin/inetd/inetd.8 |  13 ++++++++++++-
 usr.sbin/inetd/inetd.c |  26 +++++++++++++++++++-------
 2 files changed, 31 insertions(+), 8 deletions(-)

diffs (107 lines):

diff -r 8555f4407b7c -r f7c7ff64969f usr.sbin/inetd/inetd.8
--- a/usr.sbin/inetd/inetd.8    Tue Jul 04 12:57:44 2000 +0000
+++ b/usr.sbin/inetd/inetd.8    Tue Jul 04 13:25:39 2000 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: inetd.8,v 1.29 2000/06/14 16:06:43 itojun Exp $
+.\"    $NetBSD: inetd.8,v 1.30 2000/07/04 13:25:39 itojun Exp $
 .\"
 .\" Copyright (c) 1998 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -228,6 +228,14 @@
 .Dq tcp4
 or
 .Dq udp6 .
+If you would like to enable special support for
+.Xr faithd 8 ,
+prepend a keyword
+.Dq faith
+into
+.Em protocol ,
+like
+.Dq faith/tcp6 .
 .Pp
 In addition to the protocol, the configuration file may specify the
 send and receive socket buffer sizes for the listening socket.  This
@@ -409,6 +417,9 @@
 .Dq tcp4
 and
 .Dq tcp6 .
+.Dq tcp
+means TCP on top of currently-default IP version,
+which is, at this moment, IPv4.
 .Pp
 Under various combination of IPv4/v6 daemon settings,
 .Nm
diff -r 8555f4407b7c -r f7c7ff64969f usr.sbin/inetd/inetd.c
--- a/usr.sbin/inetd/inetd.c    Tue Jul 04 12:57:44 2000 +0000
+++ b/usr.sbin/inetd/inetd.c    Tue Jul 04 13:25:39 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: inetd.c,v 1.65 2000/07/04 09:33:55 itojun Exp $        */
+/*     $NetBSD: inetd.c,v 1.66 2000/07/04 13:25:39 itojun Exp $        */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -77,7 +77,7 @@
 #if 0
 static char sccsid[] = "@(#)inetd.c    8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: inetd.c,v 1.65 2000/07/04 09:33:55 itojun Exp $");
+__RCSID("$NetBSD: inetd.c,v 1.66 2000/07/04 13:25:39 itojun Exp $");
 #endif
 #endif /* not lint */
 
@@ -343,6 +343,7 @@
 #define NORM_TYPE      0
 #define MUX_TYPE       1
 #define MUXPLUS_TYPE   2
+#define FAITH_TYPE     3
 #define ISMUX(sep)     (((sep)->se_type == MUX_TYPE) || \
                         ((sep)->se_type == MUXPLUS_TYPE))
 #define ISMUXPLUS(sep) ((sep)->se_type == MUXPLUS_TYPE)
@@ -1066,9 +1067,12 @@
            SO_RCVBUF, (char *)&sep->se_rcvbuf, sizeof(sep->se_rcvbuf)) < 0)
                syslog(LOG_ERR, "setsockopt (SO_RCVBUF %d): %m",
                    sep->se_rcvbuf);
+       if (sep->se_type == FAITH_TYPE && setsockopt(sep->se_fd, IPPROTO_IPV6,
+           IPV6_FAITH, (char *)&on, sizeof(on)) < 0)
+               syslog(LOG_ERR, "setsockopt (IPV6_FAITH): %m");
 #ifdef IPSEC
-       if (ipsecsetup(sep->se_family, sep->se_fd, sep->se_policy) < 0
-        && sep->se_policy) {
+       if (ipsecsetup(sep->se_family, sep->se_fd, sep->se_policy) < 0 &&
+           sep->se_policy) {
                syslog(LOG_ERR, "%s/%s: ipsec setup failed",
                    sep->se_service, sep->se_proto);
                (void)close(sep->se_fd);
@@ -1381,7 +1385,13 @@
        else
                sep->se_socktype = -1;
 
-       sep->se_proto = newstr(sskip(&cp));
+       arg = sskip(&cp);
+       if (sep->se_type == NORM_TYPE &&
+           strncmp(arg, "faith/", strlen("faith/")) == 0) {
+               arg += strlen("faith/");
+               sep->se_type = FAITH_TYPE;
+       }
+       sep->se_proto = newstr(arg);
 
 #define        MALFORMED(arg) \
 do { \
@@ -2065,12 +2075,14 @@
                    );
        else
                fprintf(stderr,
-                   "%s: %s proto=%s, wait:max=%d.%d, user:group=%s.%s builtin=%lx server=%s"
+                   "%s: %s proto=%s%s, wait:max=%d.%d, user:group=%s.%s builtin=%lx server=%s"
 #ifdef IPSEC
                    " policy=%s"
 #endif
                    "\n",
-                   action, sep->se_service, sep->se_proto,
+                   action, sep->se_service,
+                   sep->se_type == FAITH_TYPE ? "faith/" : "",
+                   sep->se_proto,
                    sep->se_wait, sep->se_max, sep->se_user, sep->se_group,
                    (long)sep->se_bi, sep->se_server
 #ifdef IPSEC



Home | Main Index | Thread Index | Old Index