diff options
Diffstat (limited to 'debian/patches/62_inetd_change_ipv6_protocol_semantics.patch')
-rw-r--r-- | debian/patches/62_inetd_change_ipv6_protocol_semantics.patch | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/debian/patches/62_inetd_change_ipv6_protocol_semantics.patch b/debian/patches/62_inetd_change_ipv6_protocol_semantics.patch new file mode 100644 index 0000000..50ee383 --- /dev/null +++ b/debian/patches/62_inetd_change_ipv6_protocol_semantics.patch @@ -0,0 +1,80 @@ +From ee6ea58645a4db63f6ccad40566b37b23279797e Mon Sep 17 00:00:00 2001 +From: Guillem Jover <guillem@hadrons.org> +Date: Mon, 6 Sep 2010 10:52:27 +0200 +Subject: [PATCH 3/3] 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 | 20 ++++++++++++-------- + 1 files changed, 12 insertions(+), 8 deletions(-) + +diff --git a/src/inetd.c b/src/inetd.c +index 1c51a51..0d3ff69 100644 +--- a/src/inetd.c ++++ b/src/inetd.c +@@ -563,8 +563,8 @@ setup (struct servtab *sep) + if (sep->se_family == AF_INET6) + { + /* Reverse the value of SEP->se_v4mapped, since otherwise if +- using `tcp' as a protocol type all connections will be mapped +- to IPv6, and with `tcp6' they get mapped IPv4 mapped to ++ using `tcp6' as a protocol type all connections will be mapped ++ to IPv6, and with `tcp6only' they get mapped IPv4 mapped to + IPv6. */ + int val = sep->se_v4mapped ? 0 : 1; + if (setsockopt (sep->se_fd, IPPROTO_IPV6, IPV6_V6ONLY, +@@ -1002,10 +1002,9 @@ getconfigent (FILE *fconfig, const char *file, size_t *line) + sep->se_proto = newstr (argv[INETD_PROTOCOL]); + + #ifdef IPV6 +- /* We default to IPv6, in setup() we'll fall back to IPv4 if +- it doesn't work. */ +- sep->se_family = AF_INET6; +- sep->se_v4mapped = 1; ++ /* We default to IPv4. */ ++ sep->se_family = AF_INET; ++ sep->se_v4mapped = 0; + + if ((strncmp (sep->se_proto, "tcp", 3) == 0) + || (strncmp (sep->se_proto, "udp", 3) == 0)) +@@ -1013,7 +1012,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') + { +@@ -1221,7 +1224,6 @@ fix_tcpmux (void) + + serv.se_service = newstr ("tcpmux"); + serv.se_socktype = SOCK_STREAM; +- serv.se_proto = newstr ("tcp"); + serv.se_checked = 1; + serv.se_user = newstr ("root"); + serv.se_bi = bi_lookup (&serv); +@@ -1239,9 +1241,11 @@ fix_tcpmux (void) + serv.se_fd = -1; + serv.se_type = NORM_TYPE; + #ifdef IPV6 ++ serv.se_proto = newstr ("tcp6"); + serv.se_family = AF_INET6; + serv.se_v4mapped = 1; + #else ++ serv.se_proto = newstr ("tcp"); + serv.se_family = AF_INET; + #endif + if (debug) +-- +1.7.1 + |