From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4567 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?Cl=C3=A9ment?= Vasseur Newsgroups: gmane.linux.lib.musl.general Subject: getaddrinfo behaviour with AI_V4MAPPED Date: Tue, 11 Feb 2014 16:35:30 +0000 (UTC) Message-ID: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1392136809 24123 80.91.229.3 (11 Feb 2014 16:40:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 11 Feb 2014 16:40:09 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4571-gllmg-musl=m.gmane.org@lists.openwall.com Tue Feb 11 17:40:17 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1WDGNd-0008RJ-JE for gllmg-musl@plane.gmane.org; Tue, 11 Feb 2014 17:40:17 +0100 Original-Received: (qmail 21915 invoked by uid 550); 11 Feb 2014 16:40:16 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 21907 invoked from network); 11 Feb 2014 16:40:15 -0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 27 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: sd-20308.dedibox.fr User-Agent: slrn/pre1.0.0-18 (Linux) Xref: news.gmane.org gmane.linux.lib.musl.general:4567 Archived-At: Hi, I noticed a difference between musl and glibc for the following code: struct addrinfo hints; struct addrinfo *res; memset(&hints, 0, sizeof hints); hints.ai_family = AF_INET6; hints.ai_flags = AI_NUMERICHOST | AI_V4MAPPED | AI_ALL; ret = getaddrinfo("192.168.0.1", NULL, &hints, &res); musl returns EAI_NONAME (Name does not resolve) glibc returns the correct ipv6 address in ipv4-mapped format. The POSIX specification for AI_V4MAPPED says: If the AI_V4MAPPED flag is specified along with an ai_family of AF_INET6, then getaddrinfo() shall return IPv4-mapped IPv6 addresses on finding no matching IPv6 addresses ( ai_addrlen shall be 16). The AI_V4MAPPED flag shall be ignored unless ai_family equals AF_INET6. If the AI_ALL flag is used with the AI_V4MAPPED flag, then getaddrinfo() shall return all matching IPv6 and IPv4 addresses. The AI_ALL flag without the AI_V4MAPPED flag is ignored. [Option End] Shouldn't musl behave like glibc in this example?