Package: xinetd
Version: 1:2.3.14-1.1

xinetd does not bind to IPv6 addresses (and does not seem to have an
option to do so) when used in -inetd_compat mode.  As current inetd's
are IPv6-aware, this is a problem: this means xinetd cannot be used as
a drop-in inetd replacement.

The attached patch is a suggestion: it adds a -inetd_ipv6 global
option that, if used, causes inetd-compatibility lines to have an
implicit "IPv6" option.  Perhaps this is not the best solution, but
there should definitely be a way to get inetd.conf to be read in
IPv6-aware mode.

-- 
     David A. Madore
    ([EMAIL PROTECTED],
     http://www.madore.org/~david/ )
#! /bin/sh /usr/share/dpatch/dpatch-run
## 0007-inetd_compat-IPv6.dpatch by  <david@pleiades.stars>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.

@DPATCH@
diff -urNad xinetd-2.3.14~/xinetd/confparse.c xinetd-2.3.14/xinetd/confparse.c
--- xinetd-2.3.14~/xinetd/confparse.c	2005-04-08 23:35:48.000000000 +0200
+++ xinetd-2.3.14/xinetd/confparse.c	2008-03-24 11:30:08.000000000 +0100
@@ -40,6 +40,7 @@
 #include "inet.h"
 #include "main.h"
 
+extern int inetd_ipv6;
 extern int inetd_compat;
 
 /*
diff -urNad xinetd-2.3.14~/xinetd/inet.c xinetd-2.3.14/xinetd/inet.c
--- xinetd-2.3.14~/xinetd/inet.c	2003-10-01 14:46:50.000000000 +0200
+++ xinetd-2.3.14/xinetd/inet.c	2008-03-24 11:43:27.000000000 +0100
@@ -23,6 +23,8 @@
 #include "parsesup.h"
 #include "nvlists.h"
 
+extern int inetd_ipv6;
+
 static int get_next_inet_entry( int fd, pset_h sconfs, 
                           struct service_config *defaults);
 
@@ -355,6 +357,21 @@
          }
          SC_SERVER_ARGV(scp)[u] = p;
       }
+
+      /* Set the IPv6 flag if we were passed the -inetd_ipv6 option */
+      if ( inetd_ipv6 )
+      {
+         nvp = nv_find_value( service_flags, "IPv6" );
+         if ( nvp == NULL )
+         {
+            parsemsg( LOG_WARNING, func, "inetd.conf - Bad foo %s", name ) ;
+            pset_destroy(args);
+            sc_free(scp);
+            return -1;
+         }
+         M_SET(SC_XFLAGS(scp), nvp->value);
+      }
+
       /* Set the reuse flag, as this is the default for inetd */
       nvp = nv_find_value( service_flags, "REUSE" );
       if ( nvp == NULL )
diff -urNad xinetd-2.3.14~/xinetd/options.c xinetd-2.3.14/xinetd/options.c
--- xinetd-2.3.14~/xinetd/options.c	2005-10-05 23:45:41.000000000 +0200
+++ xinetd-2.3.14/xinetd/options.c	2008-03-24 11:30:25.000000000 +0100
@@ -30,6 +30,7 @@
 unsigned logprocs_option_arg ;
 int stayalive_option=0;
 char *program_name ;
+int inetd_ipv6 = 0 ;
 int inetd_compat = 0 ;
 int dont_fork = 0;
 
@@ -128,6 +129,8 @@
             fprintf(stderr, "\n");
             exit(0);
          }
+         else if ( strcmp ( &argv[ arg ][ 1 ], "inetd_ipv6" ) == 0 )
+            inetd_ipv6 = 1;
          else if ( strcmp ( &argv[ arg ][ 1 ], "inetd_compat" ) == 0 )
             inetd_compat = 1;
       }
diff -urNad xinetd-2.3.14~/xinetd/xinetd.man xinetd-2.3.14/xinetd/xinetd.man
--- xinetd-2.3.14~/xinetd/xinetd.man	2003-05-30 17:10:57.000000000 +0200
+++ xinetd-2.3.14/xinetd/xinetd.man	2008-03-24 11:33:57.000000000 +0100
@@ -106,6 +106,12 @@
 standard xinetd config files.  /etc/inetd.conf is read after the
 standard xinetd config files.
 .TP
+.BI \-inetd_ipv6
+This option causes xinetd to bind to IPv6 (AF_INET6) addresses for
+inetd compatibility lines (see previous option).  This only affects
+how /etc/inetd.conf is interpreted and thus only has any effect if
+the \-inetd_compat option is also used.
+.TP
 .BI \-cc " interval"
 This option instructs
 .B xinetd

Reply via email to