1 From f44b218ccc779ab3f4aed072390ccf129d94b58d Mon Sep 17 00:00:00 2001
2 From: David Madore <david@pleiades.stars>
3 Date: Mon, 24 Mar 2008 12:45:36 +0100
4 Subject: [PATCH] xinetd should be able to listen on IPv6 even in -inetd_compat mode
6 xinetd does not bind to IPv6 addresses (and does not seem to have an
7 option to do so) when used in -inetd_compat mode. As current inetd's
8 are IPv6-aware, this is a problem: this means xinetd cannot be used as
9 a drop-in inetd replacement.
11 The attached patch is a suggestion: it adds a -inetd_ipv6 global
12 option that, if used, causes inetd-compatibility lines to have an
13 implicit "IPv6" option. Perhaps this is not the best solution, but
14 there should definitely be a way to get inetd.conf to be read in
17 xinetd/confparse.c | 1 +
18 xinetd/inet.c | 17 +++++++++++++++++
19 xinetd/options.c | 3 +++
20 xinetd/xinetd.man | 6 ++++++
21 4 files changed, 27 insertions(+), 0 deletions(-)
23 diff --git a/xinetd/confparse.c b/xinetd/confparse.c
24 index db9f431..d7b0bcc 100644
25 --- a/xinetd/confparse.c
26 +++ b/xinetd/confparse.c
31 +extern int inetd_ipv6;
32 extern int inetd_compat;
35 diff --git a/xinetd/inet.c b/xinetd/inet.c
36 index 8caab45..2e617ae 100644
43 +extern int inetd_ipv6;
45 static int get_next_inet_entry( int fd, pset_h sconfs,
46 struct service_config *defaults);
48 @@ -360,6 +362,21 @@ static int get_next_inet_entry( int fd, pset_h sconfs,
50 SC_SERVER_ARGV(scp)[u] = p;
53 + /* Set the IPv6 flag if we were passed the -inetd_ipv6 option */
56 + nvp = nv_find_value( service_flags, "IPv6" );
59 + parsemsg( LOG_WARNING, func, "inetd.conf - Bad foo %s", name ) ;
64 + M_SET(SC_XFLAGS(scp), nvp->value);
67 /* Set the reuse flag, as this is the default for inetd */
68 nvp = nv_find_value( service_flags, "REUSE" );
70 diff --git a/xinetd/options.c b/xinetd/options.c
71 index b058b6a..dc2f3a0 100644
72 --- a/xinetd/options.c
73 +++ b/xinetd/options.c
74 @@ -30,6 +30,7 @@ int logprocs_option ;
75 unsigned logprocs_option_arg ;
76 int stayalive_option=0;
79 int inetd_compat = 0 ;
82 @@ -128,6 +129,8 @@ int opt_recognize( int argc, char *argv[] )
83 fprintf(stderr, "\n");
86 + else if ( strcmp ( &argv[ arg ][ 1 ], "inetd_ipv6" ) == 0 )
88 else if ( strcmp ( &argv[ arg ][ 1 ], "inetd_compat" ) == 0 )
91 diff --git a/xinetd/xinetd.man b/xinetd/xinetd.man
92 index c76c3c6..c9dd803 100644
93 --- a/xinetd/xinetd.man
94 +++ b/xinetd/xinetd.man
95 @@ -106,6 +106,12 @@ This option causes xinetd to read /etc/inetd.conf in addition to the
96 standard xinetd config files. /etc/inetd.conf is read after the
97 standard xinetd config files.
100 +This option causes xinetd to bind to IPv6 (AF_INET6) addresses for
101 +inetd compatibility lines (see previous option). This only affects
102 +how /etc/inetd.conf is interpreted and thus only has any effect if
103 +the \-inetd_compat option is also used.
106 This option instructs