Add NI_NUMERICSCOPE support to getnameinfo
Commit Message
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
@@ -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.
@@ -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);