{"id":810215,"url":"http://patchwork.ozlabs.org/api/patches/810215/?format=json","web_url":"http://patchwork.ozlabs.org/project/glibc/patch/20170905160530.19525-5-stlman@poczta.fm/","project":{"id":41,"url":"http://patchwork.ozlabs.org/api/projects/41/?format=json","name":"GNU C Library","link_name":"glibc","list_id":"libc-alpha.sourceware.org","list_email":"libc-alpha@sourceware.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170905160530.19525-5-stlman@poczta.fm>","list_archive_url":null,"date":"2017-09-05T16:05:30","name":"[RFC,4/4,BZ,17083] getaddrinfo: Use the new getaddrinfo5_r NSS function","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"14e56d51f670487e74ed02bc8ffbbc6d11b0b214","submitter":{"id":72297,"url":"http://patchwork.ozlabs.org/api/people/72297/?format=json","name":"Łukasz Stelmach","email":"stlman@poczta.fm"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/glibc/patch/20170905160530.19525-5-stlman@poczta.fm/mbox/","series":[{"id":1605,"url":"http://patchwork.ozlabs.org/api/series/1605/?format=json","web_url":"http://patchwork.ozlabs.org/project/glibc/list/?series=1605","date":"2017-09-05T16:05:26","name":"Make getaddrinfo(3) return zone id from /etc/hosts for link-local IPv6 addresses","version":1,"mbox":"http://patchwork.ozlabs.org/series/1605/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/810215/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/810215/checks/","tags":{},"related":[],"headers":{"Return-Path":"<libc-alpha-return-84193-incoming=patchwork.ozlabs.org@sourceware.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list libc-alpha@sourceware.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=sourceware.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=libc-alpha-return-84193-incoming=patchwork.ozlabs.org@sourceware.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tsecure) header.d=sourceware.org header.i=@sourceware.org\n\theader.b=\"f5XSvK7H\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xms6D3HWBz9t16\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed,  6 Sep 2017 02:06:44 +1000 (AEST)","(qmail 118119 invoked by alias); 5 Sep 2017 16:06:19 -0000","(qmail 118097 invoked by uid 89); 5 Sep 2017 16:06:19 -0000"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id\n\t:list-unsubscribe:list-subscribe:list-archive:list-post\n\t:list-help:sender:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-type:content-transfer-encoding;\n\tq=dns; s=default; b=g2xQKDAYdCLOx5sh1QpNzFlQNI3CrcT6P38fcvionow\n\tcncQ4pWi2aESfYdx1g7NU/ZIlAVV7kQkDXSomSUcPSKaa3E/FPxslAt8T70Pvjz0\n\tyIJ+DRkibQ9NMhoxhHEbnwPXudeE/KRh2dBGvqoBHKWWRvdQOYyEA6LoKS2xqcCY\n\t=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id\n\t:list-unsubscribe:list-subscribe:list-archive:list-post\n\t:list-help:sender:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-type:content-transfer-encoding;\n\ts=default; bh=4aDEJy7oChnVIM4x8f6y43UIyTI=; b=f5XSvK7HbjoQiXnJQ\n\tx6Vmw+esDetIA1lhvE3cK4Ed7kEXKrTBluYvX8oBwjmcfaUa7gz08B8ehatIRz46\n\tUIo8kvDcVM86p+NvO9jigOzME1I54QpfSaBCVgNWGaCBApW/YPfnp+NdDUTCkP/9\n\tVLHAnHW2G4CBNBptbok6XfWLMk=","Mailing-List":"contact libc-alpha-help@sourceware.org; run by ezmlm","Precedence":"bulk","List-Id":"<libc-alpha.sourceware.org>","List-Unsubscribe":"<mailto:libc-alpha-unsubscribe-incoming=patchwork.ozlabs.org@sourceware.org>","List-Subscribe":"<mailto:libc-alpha-subscribe@sourceware.org>","List-Archive":"<http://sourceware.org/ml/libc-alpha/>","List-Post":"<mailto:libc-alpha@sourceware.org>","List-Help":"<mailto:libc-alpha-help@sourceware.org>,\n\t<http://sourceware.org/ml/#faqs>","Sender":"libc-alpha-owner@sourceware.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-26.2 required=5.0 tests=AWL, BAYES_00,\n\tFREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2,\n\tGIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.2 spammy=AAAA,\n\tHx-languages-length:1898, aaaa,\n\tHContent-Transfer-Encoding:8bit","X-HELO":"smtpo.poczta.interia.pl","X-Interia-R":"Interia","X-Interia-R-IP":"89.64.33.181","X-Interia-R-Helo":"<localhost>","From":"=?utf-8?q?=C5=81ukasz_Stelmach?= <stlman@poczta.fm>","To":"libc-alpha@sourceware.org","Cc":"=?utf-8?q?=C5=81ukasz_Stelmach?= <stlman@poczta.fm>","Subject":"[RFC][PATCH 4/4][BZ 17083] getaddrinfo: Use the new getaddrinfo5_r\n\tNSS function","Date":"Tue,  5 Sep 2017 18:05:30 +0200","Message-Id":"<20170905160530.19525-5-stlman@poczta.fm>","In-Reply-To":"<20170905160530.19525-1-stlman@poczta.fm>","References":"<20170905160530.19525-1-stlman@poczta.fm>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","X-Interia-Antivirus":"OK","X-IPL-POID":"4","X-IPL-SAS-SPAS":"-0.6","X-IPL-SAS-UREP":"0","X-IPL-SAS-UREP-PRIV":"0","X-IPL-Envelope-To":"stlman@poczta.fm"},"content":"Signed-off-by: Łukasz Stelmach <stlman@poczta.fm>\n---\n sysdeps/posix/getaddrinfo.c | 26 +++++++++++++++++++-------\n 1 file changed, 19 insertions(+), 7 deletions(-)","diff":"diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c\nindex 4b4e192e89..38e231091a 100644\n--- a/sysdeps/posix/getaddrinfo.c\n+++ b/sysdeps/posix/getaddrinfo.c\n@@ -302,6 +302,10 @@ convert_hostent_to_gaih_addrtuple (const struct addrinfo *req,\n  }\n \n \n+typedef enum nss_status (*nss_gethostbyname5_r)\n+  (const char *name, int af, struct gaih_addrtuple **pat,\n+   char *buffer, size_t buflen, int *errnop,\n+   int *h_errnop, int32_t *ttlp);\n typedef enum nss_status (*nss_gethostbyname4_r)\n   (const char *name, struct gaih_addrtuple **pat,\n    char *buffer, size_t buflen, int *errnop,\n@@ -777,19 +781,27 @@ gaih_inet (const char *name, const struct gaih_service *service,\n \t      no_data = 0;\n \t      nss_gethostbyname4_r fct4 = NULL;\n \n+\t      /* gethostbyname5_r accepts af argument and returns\n+\t\t gaih_addrtupple. What more do we need? */\n+\t      nss_gethostbyname5_r fct5 = __nss_lookup_function (nip, \"gethostbyname5_r\");\n \t      /* gethostbyname4_r sends out parallel A and AAAA queries and\n \t\t is thus only suitable for PF_UNSPEC.  */\n-\t      if (req->ai_family == PF_UNSPEC)\n+\t      if (req->ai_family == PF_UNSPEC && fct5 == NULL)\n \t\tfct4 = __nss_lookup_function (nip, \"gethostbyname4_r\");\n-\n-\t      if (fct4 != NULL)\n+\t      if (fct5 != NULL || fct4 != NULL)\n \t\t{\n \t\t  while (1)\n \t\t    {\n-\t\t      status = DL_CALL_FCT (fct4, (name, pat,\n-\t\t\t\t\t\t   tmpbuf->data, tmpbuf->length,\n-\t\t\t\t\t\t   &errno, &h_errno,\n-\t\t\t\t\t\t   NULL));\n+\t\t      if (fct5 != NULL)\n+\t\t\tstatus = DL_CALL_FCT (fct5, (name, req->ai_family, pat,\n+\t\t\t\t\t\t     tmpbuf->data, tmpbuf->length,\n+\t\t\t\t\t\t     &errno, &h_errno,\n+\t\t\t\t\t\t     NULL));\n+\t\t      else\n+\t\t\tstatus = DL_CALL_FCT (fct4, (name, pat,\n+\t\t\t\t\t\t     tmpbuf->data, tmpbuf->length,\n+\t\t\t\t\t\t     &errno, &h_errno,\n+\t\t\t\t\t\t     NULL));\n \t\t      if (status == NSS_STATUS_SUCCESS)\n \t\t\tbreak;\n \t\t      if (status != NSS_STATUS_TRYAGAIN\n","prefixes":["RFC","4/4","BZ","17083"]}