[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#800682: libc6: nscd reports bogus result for ipv6-only requests



Package: libc6
Version: 2.19-20
Severity: normal
Tags: upstream fixed-upstream patch

Hello,

without nscd:
$ ping6 -n kamino
PING kamino(2001:db8:210::20) 56 data bytes
64 bytes from 2001:db8:210::20: icmp_seq=1 ttl=64 time=0.303 ms

with nscd:
$ ping6 -n kamino
PING kamino(a00:d214:2001:db8:210::) 56 data bytes

(0x0a.0x00.0xd2.0x14 happens to be the IPv4 of kamino)

This is due to a missing commit backport for Bug#798515.  I have pushed
the missing commit in the upstream 2.19 branch (8dc9751 cherry-picked as
b0f0937).  We can either upload a 2.19-23 to get it fixed, or just wait
for 2.21 (which already has the fix) to get uploaded.

Samuel

-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'oldoldstable'), (500, 'buildd-unstable'), (500, 'unstable'), (500, 'stable'), (500, 'oldstable'), (1, 'buildd-experimental'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.2.2 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

-- 
Samuel
...
<rv_> et Ctrl alt F2 pour aller sous console
<rv_> mais c koi pour passer d'un bureau a un autre !
<rv_> au fait c koi le raccourci pour passer d'un bureau a un autre 'question stupide"
<cycyx> ça dépend du window manager et de ta conf
<Firebird> ce qui fonctionne toujours c'est CTRL-ALT-BCKSP
-:- SignOff rv_: #linuxfr (Read error: EOF from client)
-:- rv_ [~rv@217.11.166.169] has joined #linuxfr
<rv_> Firebird: MEURT...
commit 8dc9751764eb1bedf06d19695524b31a16773413
Author: Andreas Schwab <schwab@suse.de>
Date:   Wed May 7 11:47:20 2014 +0200

    Fix parsing of getai result from nscd for IPv6-only request

diff --git a/ChangeLog b/ChangeLog
index 6c50016..cb09dd7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,13 @@
+2014-05-07  Andreas Schwab  <schwab@suse.de>
+
+	* sysdeps/posix/getaddrinfo.c (gaih_inet): Advance address pointer
+	when skipping over non-matching result from nscd.
+
 2014-05-07  Ondřej Bílka  <neleai@seznam.cz>
 
 	[BZ #16876]
 	* nptl/sockperf.c (client): Check socket return value.
+
 	[BZ #16877]
 	* nscd/selinux.c (nscd_request_avc_has_perm): Check if there is
 	nscd security class.
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 3385bed..6258330 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -710,16 +710,20 @@ gaih_inet (const char *name, const struct gaih_service *service,
 		  struct gaih_addrtuple *addrfree = addrmem;
 		  for (int i = 0; i < air->naddrs; ++i)
 		    {
+		      socklen_t size = (air->family[i] == AF_INET
+					? INADDRSZ : IN6ADDRSZ);
+
 		      if (!((air->family[i] == AF_INET
 			     && req->ai_family == AF_INET6
 			     && (req->ai_flags & AI_V4MAPPED) != 0)
 			    || req->ai_family == AF_UNSPEC
 			    || air->family[i] == req->ai_family))
-			/* Skip over non-matching result.  */
-			continue;
+			{
+			  /* Skip over non-matching result.  */
+			  addrs += size;
+			  continue;
+			}
 
-		      socklen_t size = (air->family[i] == AF_INET
-					? INADDRSZ : IN6ADDRSZ);
 		      if (*pat == NULL)
 			{
 			  *pat = addrfree++;

Reply to: