From patchwork Fri Jun 20 22:44:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rich Felker X-Patchwork-Id: 362363 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49B82140086 for ; Sat, 21 Jun 2014 08:44:38 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:in-reply-to; q=dns; s=default; b=VN2M DWqLty1hrXq2dzIne+9OXg16pxBscIsBCDMhmcTDHCeHMMIPxIefnEoCYDBkN7sC uxrSh+ACSUczI+fyJMQNcJ3aIk+geIUsMW11kVyLFGAl/0HOMUKjbuT7qzDopQK0 rLP/L1UtC9YtkS+j42JSpOG8+tSLFCaHcq5y2eU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:in-reply-to; s=default; bh=t0FRiPqZf/ hb4fHuKLX8v5f88jc=; b=RG0W4BRn14lont1Y8lDAK8VmBSJxicHPBriSway2pA FHr2KplQnNnwUXWlhYBoqXyI3nxP5P+iUTk/i+00MsG7EQSI52rIgHjGe2U1MKPG sebAQu+aFuqZs1iVtIMNhQ64MAmvdTrBZ/p1qpfk39kcu6wLYOdTh7CpHax3wWvL I= Received: (qmail 23358 invoked by alias); 20 Jun 2014 22:44:32 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 23340 invoked by uid 89); 20 Jun 2014 22:44:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.4 required=5.0 tests=AWL, BAYES_00, RDNS_DYNAMIC, TVD_RCVD_IP autolearn=no version=3.3.2 X-HELO: brightrain.aerifal.cx Date: Fri, 20 Jun 2014 18:44:23 -0400 From: Rich Felker To: "Joseph S. Myers" Cc: libc-alpha@sourceware.org Subject: [PATCH] Add NI_NUMERICSCOPE support to getnameinfo Message-ID: <20140620224423.GC179@brightrain.aerifal.cx> References: <20121014220643.GA17229@brightrain.aerifal.cx> <20140604025109.GL507@brightrain.aerifal.cx> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) On Thu, Jun 19, 2014 at 10:13:11PM +0000, Joseph S. Myers wrote: > On Tue, 3 Jun 2014, Rich Felker wrote: > > > On Sun, Oct 14, 2012 at 06:06:43PM -0400, Rich Felker wrote: > > > See bug #14102: http://sourceware.org/bugzilla/show_bug.cgi?id=14102 > > > > > > Even if nobody is willing to add the functionality immediately, can we > > > at least agree on a value it will have when it's added? > > > > This issue is really trivial and I've been waiting for someone to > > address it for almost 2 years now. Is the attached patch acceptable? > > You need to explain why you think ignoring the flag is a valid > implementation (or that defining it without implementing it is more > helpful to applications, or better accords with established glibc > conventions, than not defining it until there is an implementation). Trivial patch attached. Rich --- resolv/netdb.h.orig 2014-06-03 22:58:26.000000000 -0400 +++ resolv/netdb.h 2014-06-03 23:00:06.000000000 -0400 @@ -653,6 +653,7 @@ # define NI_IDN_USE_STD3_ASCII_RULES 128 /* Validate strings according to STD3 rules. */ # endif +# define NI_NUMERICSCOPE 256 /* Don't convert scope_id to name. */ /* Translate name of a service location and/or a service name to set of socket addresses. --- inet/getnameinfo.c.orig 2014-02-07 04:04:38.000000000 -0500 +++ inet/getnameinfo.c 2014-06-20 18:49:54.000000000 -0400 @@ -331,7 +331,8 @@ if (IN6_IS_ADDR_LINKLOCAL (&sin6p->sin6_addr) || IN6_IS_ADDR_MC_LINKLOCAL (&sin6p->sin6_addr)) { - if (if_indextoname (scopeid, scopeptr) == NULL) + if ((flags & NI_NUMERICSCOPE) || + if_indextoname (scopeid, scopeptr) == NULL) ++ni_numericscope; else scopelen = strlen (scopebuf);