From 4762a0e2acd15d9e71904eb223ee37defeae847e Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@hadrons.org>
Date: Mon, 6 Sep 2010 10:52:27 +0200
Subject: [PATCH 58/60] inetd: Change protocol semantics in inetd.conf

* src/inetd.c (setup): Update comment.
(getconfigent) [IPV6]: Change default family to IPv4 for "tcp" and
"udp". Change "tcp6" and "udp6" to support IPv4 mapped addresses.
Add "tcp6only" and "udp6only" protocols for IPv6 only addresses.
(fix_tcpmux) [IPV6]: Set se_proto to "tcp6".
[!IPV6]: Set se_proto to "tcp".
---
 src/inetd.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/inetd.c b/src/inetd.c
index ae7ab37d..fcfeffae 100644
--- a/src/inetd.c
+++ b/src/inetd.c
@@ -1109,9 +1109,9 @@ getconfigent (FILE *fconfig, const char *file, size_t *line)
       sep->se_proto = newstr (argv[INETD_PROTOCOL]);
 
 #ifdef IPV6
-      /* We default to IPv4. */
+      /* We default to IPv4.  */
       sep->se_family = AF_INET;
-      sep->se_v4mapped = 1;
+      sep->se_v4mapped = 0;
 
       if ((strncmp (sep->se_proto, "tcp", 3) == 0)
 	  || (strncmp (sep->se_proto, "udp", 3) == 0))
@@ -1119,10 +1119,11 @@ getconfigent (FILE *fconfig, const char *file, size_t *line)
 	  if (sep->se_proto[3] == '6')
 	    {
 	      sep->se_family = AF_INET6;
-	      sep->se_v4mapped = 0;
 	      /* Check for tcp6only and udp6only.  */
 	      if (strcmp (&sep->se_proto[3], "6only") == 0)
 	        sep->se_v4mapped = 0;
+	      else
+	        sep->se_v4mapped = 1;
 	    }
 	  else if (sep->se_proto[3] == '4')
 	    {
-- 
2.26.0.292.g33ef6b2f38

