add faithd(8) support. with "faith/tcp6" protocol specification,

it will open a socket with setsockopt(IPV6_FAITH).
This commit is contained in:
itojun 2000-07-04 13:25:39 +00:00
parent 141ff1b566
commit 798ee6865c
2 changed files with 31 additions and 8 deletions

View File

@ -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 @@ If you need to specify IPv4 or IPv6 explicitly, use something like
.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 @@ for
.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

View File

@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1991, 1993, 1994\n\
#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 @@ struct servtab {
#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 @@ setsockopt(fd, SOL_SOCKET, opt, (char *)&on, sizeof (on))
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 @@ more:
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 @@ print_service(action, sep)
);
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