xinetd-should-be-able-to-listen-on-IPv6-even-in-ine.patch 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. Upstream-Status: Pending [from other distro Debian]
  2. From f44b218ccc779ab3f4aed072390ccf129d94b58d Mon Sep 17 00:00:00 2001
  3. From: David Madore <david@pleiades.stars>
  4. Date: Mon, 24 Mar 2008 12:45:36 +0100
  5. 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.
  10. The attached patch is a suggestion: it adds a -inetd_ipv6 global
  11. option that, if used, causes inetd-compatibility lines to have an
  12. implicit "IPv6" option. Perhaps this is not the best solution, but
  13. there should definitely be a way to get inetd.conf to be read in
  14. IPv6-aware mode.
  15. ---
  16. xinetd/confparse.c | 1 +
  17. xinetd/inet.c | 17 +++++++++++++++++
  18. xinetd/options.c | 3 +++
  19. xinetd/xinetd.man | 6 ++++++
  20. 4 files changed, 27 insertions(+), 0 deletions(-)
  21. diff --git a/xinetd/confparse.c b/xinetd/confparse.c
  22. index db9f431..d7b0bcc 100644
  23. --- a/xinetd/confparse.c
  24. +++ b/xinetd/confparse.c
  25. @@ -40,6 +40,7 @@
  26. #include "inet.h"
  27. #include "main.h"
  28. +extern int inetd_ipv6;
  29. extern int inetd_compat;
  30. /*
  31. diff --git a/xinetd/inet.c b/xinetd/inet.c
  32. index 8caab45..2e617ae 100644
  33. --- a/xinetd/inet.c
  34. +++ b/xinetd/inet.c
  35. @@ -25,6 +25,8 @@
  36. static psi_h iter ;
  37. +extern int inetd_ipv6;
  38. +
  39. static int get_next_inet_entry( int fd, pset_h sconfs,
  40. struct service_config *defaults);
  41. @@ -360,6 +362,21 @@ static int get_next_inet_entry( int fd, pset_h sconfs,
  42. }
  43. SC_SERVER_ARGV(scp)[u] = p;
  44. }
  45. +
  46. + /* Set the IPv6 flag if we were passed the -inetd_ipv6 option */
  47. + if ( inetd_ipv6 )
  48. + {
  49. + nvp = nv_find_value( service_flags, "IPv6" );
  50. + if ( nvp == NULL )
  51. + {
  52. + parsemsg( LOG_WARNING, func, "inetd.conf - Bad foo %s", name ) ;
  53. + pset_destroy(args);
  54. + sc_free(scp);
  55. + return -1;
  56. + }
  57. + M_SET(SC_XFLAGS(scp), nvp->value);
  58. + }
  59. +
  60. /* Set the reuse flag, as this is the default for inetd */
  61. nvp = nv_find_value( service_flags, "REUSE" );
  62. if ( nvp == NULL )
  63. diff --git a/xinetd/options.c b/xinetd/options.c
  64. index b058b6a..dc2f3a0 100644
  65. --- a/xinetd/options.c
  66. +++ b/xinetd/options.c
  67. @@ -30,6 +30,7 @@ int logprocs_option ;
  68. unsigned logprocs_option_arg ;
  69. int stayalive_option=0;
  70. char *program_name ;
  71. +int inetd_ipv6 = 0 ;
  72. int inetd_compat = 0 ;
  73. int dont_fork = 0;
  74. @@ -128,6 +129,8 @@ int opt_recognize( int argc, char *argv[] )
  75. fprintf(stderr, "\n");
  76. exit(0);
  77. }
  78. + else if ( strcmp ( &argv[ arg ][ 1 ], "inetd_ipv6" ) == 0 )
  79. + inetd_ipv6 = 1;
  80. else if ( strcmp ( &argv[ arg ][ 1 ], "inetd_compat" ) == 0 )
  81. inetd_compat = 1;
  82. }
  83. diff --git a/xinetd/xinetd.man b/xinetd/xinetd.man
  84. index c76c3c6..c9dd803 100644
  85. --- a/xinetd/xinetd.man
  86. +++ b/xinetd/xinetd.man
  87. @@ -106,6 +106,12 @@ This option causes xinetd to read /etc/inetd.conf in addition to the
  88. standard xinetd config files. /etc/inetd.conf is read after the
  89. standard xinetd config files.
  90. .TP
  91. +.BI \-inetd_ipv6
  92. +This option causes xinetd to bind to IPv6 (AF_INET6) addresses for
  93. +inetd compatibility lines (see previous option). This only affects
  94. +how /etc/inetd.conf is interpreted and thus only has any effect if
  95. +the \-inetd_compat option is also used.
  96. +.TP
  97. .BI \-cc " interval"
  98. This option instructs
  99. .B xinetd
  100. --
  101. 1.5.5.rc0.127.gb4337