mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Cc: Philip Homburg <philip.homburg@ripe.net>
Subject: Re: inet_ntop bug in 1.1.19
Date: Tue, 26 Jun 2018 16:56:38 -0400	[thread overview]
Message-ID: <20180626205638.GC1392@brightrain.aerifal.cx> (raw)
In-Reply-To: <20180605003724.GZ1392@brightrain.aerifal.cx>

I think Philip somehow got un-Cc'd and missed further discussion:

On Mon, Jun 04, 2018 at 08:37:24PM -0400, Rich Felker wrote:
> On Mon, Jun 04, 2018 at 09:39:21PM +0300, Timo Teras wrote:
> > On Mon, 04 Jun 2018 14:23:55 +0000
> > "Laurent Bercot" <ska-dietlibc@skarnet.org> wrote:
> > 
> > > >inet_ntop doesn't conform to RFC 5952 (A Recommendation for IPv6 
> > > >Address
> > > >Text Representation).
> > > >
> > > >I attached a test program to demonstrate the issue and a patch:
> > > >$ cc inet_ntop_test.c musl-1.1.19/src/network/inet_ntop.c
> > > >$ ./a.out
> > > >Section 4.2.2 test failed: got 2001:db8::1:1:1:1:1, expected
> > > >2001:db8:0:1:1:1:1:1  
> > > 
> > >   https://tools.ietf.org/html/rfc5952#section-4.2.1 says:
> > >   "The use of the symbol "::" MUST be used to its maximum capability."
> > > 
> > >   2001:db8::1:1:1:1:1 is the correct canonical text representation.
> > 
> > The following section 4.2.2  says:
> > 
> > 4.2.2.  Handling One 16-Bit 0 Field
> > 
> >    The symbol "::" MUST NOT be used to shorten just one 16-bit 0 field.
> >    For example, the representation 2001:db8:0:1:1:1:1:1 is correct, but
> >    2001:db8::1:1:1:1:1 is not correct.
> > 
> > Looks like the test case is taken directly from this.
> 
> Lovely -- 4.2.1 and 4.2.2 are outright conflicting. I suppose you're
> expected to interpret 4.2.1 as "maximum capability subject to the
> nonsensical additional constraint below".
> 
> In any case, 4.2.2 probably makes things prettier to read even if it
> does take an extra character.
> 
> I checked and only RFC 2373 is actually normative for inet_pton (per
> POSIX), but it doesn't contradict anything in RFC 5952 or provide any
> preferred conventions for reverse mapping, so I think it's safe to
> adopt the rule in 4.2.2 above.
> 
> Sound ok?

Arthur Jones subsequently submitted a slightly simpler patch which I'm
applying. Let me know if anything still seems wrong. It now passes the
test case.

Rich


      reply	other threads:[~2018-06-26 20:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-04 13:57 Philip Homburg
2018-06-04 14:23 ` Laurent Bercot
2018-06-04 18:39   ` Timo Teras
2018-06-05  0:37     ` Rich Felker
2018-06-26 20:56       ` Rich Felker [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180626205638.GC1392@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    --cc=philip.homburg@ripe.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).