Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/810214/?format=api
{ "id": 810214, "url": "http://patchwork.ozlabs.org/api/patches/810214/?format=api", "web_url": "http://patchwork.ozlabs.org/project/glibc/patch/20170905160530.19525-3-stlman@poczta.fm/", "project": { "id": 41, "url": "http://patchwork.ozlabs.org/api/projects/41/?format=api", "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-3-stlman@poczta.fm>", "list_archive_url": null, "date": "2017-09-05T16:05:28", "name": "[RFC,2/4,BZ,17083] NSS: Parse zone identifier of IPv6 addresses in /etc/hosts", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "1bfeb0d1dccccfd6f0684fc3b60c47327a467ed3", "submitter": { "id": 72297, "url": "http://patchwork.ozlabs.org/api/people/72297/?format=api", "name": "Łukasz Stelmach", "email": "stlman@poczta.fm" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/glibc/patch/20170905160530.19525-3-stlman@poczta.fm/mbox/", "series": [ { "id": 1605, "url": "http://patchwork.ozlabs.org/api/series/1605/?format=api", "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/810214/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/810214/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<libc-alpha-return-84192-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-84192-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=\"mtaSXjI9\"; 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 3xms630JZPz9ryk\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 6 Sep 2017 02:06:34 +1000 (AEST)", "(qmail 117912 invoked by alias); 5 Sep 2017 16:06:18 -0000", "(qmail 117847 invoked by uid 89); 5 Sep 2017 16:06:18 -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=Id6Civnfgzhd1e+6ElCpMansZPv7XwVRb5tpRqAzKDb\n\tT9xGC2SqNy7eWLT/gqWWjc6xbqm2YKqucl3z39k1HpNeFlzZATBemubQwvkEOA9R\n\tP/+zo0CFTr7IlcOUU2zAC2UpNyEI4iLVFBkoukGrRKEzxqRdqJxOMLVxZtjZkcL0\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=F/6Pl2vdltD/sf5aaZ+mXC5WOTA=; b=mtaSXjI9Py9RzPtHZ\n\teh/SOy+N8rQfZaQOx3dnGsup8jhxXu1NdCPH/Egqw14PhchI4JZDvzFKcCWtExd1\n\tTe/0fvKEEjub3JQr+j7LQmib4wCfY50d5HbQ91NCvQzn7VYbJi+xBEOQn/B9vGlB\n\tmuVZGfAeNR6CsSKUx3cEivwY8A=", "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=-25.9 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=1727", "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 2/4][BZ 17083] NSS: Parse zone identifier of IPv6\n\taddresses in /etc/hosts", "Date": "Tue, 5 Sep 2017 18:05:28 +0200", "Message-Id": "<20170905160530.19525-3-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": "Parse link-local IPv6 addresses in /etc/hosts, which contain zone\nidentifiers as described in RFC 4007.\n\nSigned-off-by: Łukasz Stelmach <stlman@poczta.fm>\n---\n nss/nss_files/files-hosts.c | 54 ++++++++++++++++++++++++++++++++++++++-------\n 1 file changed, 46 insertions(+), 8 deletions(-)", "diff": "diff --git a/nss/nss_files/files-hosts.c b/nss/nss_files/files-hosts.c\nindex bccb6a5780..28eb73fb2d 100644\n--- a/nss/nss_files/files-hosts.c\n+++ b/nss/nss_files/files-hosts.c\n@@ -33,8 +33,8 @@\n #define DATABASE\t\"hosts\"\n #define NEED_H_ERRNO\n \n-#define EXTRA_ARGS\t , af, flags\n-#define EXTRA_ARGS_DECL\t , int af, int flags\n+#define EXTRA_ARGS\t , af, flags, in6_zone_id\n+#define EXTRA_ARGS_DECL\t , int af, int flags, uint32_t *in6_zone_id\n \n #define ENTDATA hostent_data\n struct hostent_data\n@@ -53,6 +53,9 @@ LINE_PARSER\n \n STRING_FIELD (addr, isspace, 1);\n \n+ if (in6_zone_id != NULL)\n+ *in6_zone_id = 0;\n+\n /* Parse address. */\n if (inet_pton (af == AF_UNSPEC ? AF_INET : af, addr, entdata->host_addr)\n > 0)\n@@ -80,6 +83,40 @@ LINE_PARSER\n else if (af == AF_UNSPEC\n \t\t&& inet_pton (AF_INET6, addr, entdata->host_addr) > 0)\n \t af = AF_INET6;\n+ else if (strchr(addr, SCOPE_DELIMITER) != NULL)\n+\t {\n+\t /* Parse a zone identifier RFC 4007 11. */\n+\t struct addrinfo hints;\n+\t struct addrinfo *res;\n+\t struct sockaddr_in6 *sa;\n+\t int ret;\n+\n+\t /* Only IPv6 link-local addresses can have zone identifiers. */\n+\t af = AF_INET6;\n+\n+\t memset(&hints, 0, sizeof(struct addrinfo));\n+\t /* Don't perform any lookups. */\n+\t hints.ai_flags = AI_NUMERICHOST;\n+\t hints.ai_family = AF_INET6;\n+\n+\t ret = getaddrinfo(addr, NULL, &hints, &res);\n+\t if (ret != 0)\n+\t return 0;\n+\n+\t sa = (struct sockaddr_in6*)res->ai_addr;\n+\n+\t /* Zone identifiers makes sense only for link-local addresses. */\n+\t if (!IN6_IS_ADDR_LINKLOCAL(sa->sin6_addr.s6_addr)) {\n+\t freeaddrinfo(res);\n+\t return 0;\n+\t }\n+\n+\t if (in6_zone_id != NULL)\n+\t *in6_zone_id = sa->sin6_scope_id;\n+\n+\t memcpy(entdata->host_addr, &sa->sin6_addr, IN6ADDRSZ);\n+\t freeaddrinfo(res);\n+\t }\n else\n \t /* Illegal address: ignore line. */\n \t return 0;\n@@ -99,14 +136,14 @@ LINE_PARSER\n \n #define EXTRA_ARGS_VALUE \\\n , (res_use_inet6 () ? AF_INET6 : AF_INET),\t\t \\\n- (res_use_inet6 () ? AI_V4MAPPED : 0)\n+ (res_use_inet6 () ? AI_V4MAPPED : 0), NULL\n #include \"files-XXX.c\"\n #undef EXTRA_ARGS_VALUE\n \n /* We only need to consider IPv4 mapped addresses if the input to the\n gethostbyaddr() function is an IPv6 address. */\n #define EXTRA_ARGS_VALUE \\\n- , af, (len == IN6ADDRSZ ? AI_V4MAPPED : 0)\n+ , af, (len == IN6ADDRSZ ? AI_V4MAPPED : 0), NULL\n DB_LOOKUP (hostbyaddr, ,,,\n \t {\n \t if (result->h_length == (int) len\n@@ -135,7 +172,7 @@ _nss_files_gethostbyname3_r (const char *name, int af, struct hostent *result,\n int flags = (res_use_inet6 () ? AI_V4MAPPED : 0);\n \n while ((status = internal_getent (stream, result, buffer, buflen, errnop,\n-\t\t\t\t\therrnop, af, flags))\n+\t\t\t\t\therrnop, af, flags, NULL))\n \t == NSS_STATUS_SUCCESS)\n \t{\n \t LOOKUP_NAME_CASE (h_name, h_aliases)\n@@ -163,7 +200,7 @@ _nss_files_gethostbyname3_r (const char *name, int af, struct hostent *result,\n \tagain:\n \t while ((status = internal_getent (stream, &tmp_result_buf, tmp_buffer,\n \t\t\t\t\t tmp_buflen, errnop, herrnop, af,\n-\t\t\t\t\t flags))\n+\t\t\t\t\t flags, NULL))\n \t\t == NSS_STATUS_SUCCESS)\n \t {\n \t int matches = 1;\n@@ -385,12 +422,13 @@ _nss_files_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,\n \t /* Align the buffer for the next record. */\n \t uintptr_t pad = (-(uintptr_t) buffer\n \t\t\t % __alignof__ (struct hostent_data));\n+\t uint32_t in6_zone_id = 0;\n \t buffer += pad;\n \t buflen = buflen > pad ? buflen - pad : 0;\n \n \t struct hostent result;\n \t status = internal_getent (stream, &result, buffer, buflen, errnop,\n-\t\t\t\t herrnop, AF_UNSPEC, 0);\n+\t\t\t\t herrnop, AF_UNSPEC, 0, &in6_zone_id);\n \t if (status != NSS_STATUS_SUCCESS)\n \t break;\n \n@@ -448,7 +486,7 @@ _nss_files_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,\n \t got_canon = true;\n \t (*pat)->family = result.h_addrtype;\n \t memcpy ((*pat)->addr, result.h_addr_list[0], result.h_length);\n-\t (*pat)->scopeid = 0;\n+\t (*pat)->scopeid = in6_zone_id;\n \n \t pat = &((*pat)->next);\n \n", "prefixes": [ "RFC", "2/4", "BZ", "17083" ] }