Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Jul 2012 21:39:06 -0400
From:      Arnaud Lacombe <lacombar@gmail.com>
To:        "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net>
Cc:        Luigi Rizzo <rizzo@iet.unipi.it>, current@freebsd.org
Subject:   Re: RFC: libkern version of inet_ntoa_r
Message-ID:  <CACqU3MX40tB%2BZMBTvipTuka2grPRLHLJ6WfpDdn46WScYmFpyg@mail.gmail.com>
In-Reply-To: <CACqU3MWjco2o6ZMD1syujHtBGegYZ84Prw9w0UFG9p68B2Drmg@mail.gmail.com>
References:  <20120725155211.GA33971@onelab2.iet.unipi.it> <alpine.BSF.2.00.1207282213171.4474@ai.fobar.qr> <CACqU3MVjcHBkc_PYViTX51rJX7m_eq7Bf7uNH0QFqQVnkyddYA@mail.gmail.com> <alpine.BSF.2.00.1207282238420.4474@ai.fobar.qr> <CACqU3MWjco2o6ZMD1syujHtBGegYZ84Prw9w0UFG9p68B2Drmg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

On Sat, Jul 28, 2012 at 7:46 PM, Arnaud Lacombe <lacombar@gmail.com> wrote:
> Hi,
>
> On Sat, Jul 28, 2012 at 6:44 PM, Bjoern A. Zeeb
> <bzeeb-lists@lists.zabbadoz.net> wrote:
>> Which again leaves me with the question - why does libc have it?
>>
> as for the semantic, theoretical, "why", I would refer you to the
> POSIX's comity, as inet_ntop() is part of it.
>
actually, it is slightly more complicated than that. POSIX has
inet_ntoa(), inet_ntop() and no inet_ntoa_r(). libc's inet_ntoa{,_r}()
are implemented on top inet_ntop(), which *does* fail if the provided
buffer is not large enough, and set errno to ENOSPC. However,
inet_ntoa{,_r}() do not propagate inet_ntop() failure.

As for the userland version of inet_ntoa{,_r}(), I would change it to
at least stop ignoring inet_ntop() return value, add an assertion on
its success, drop this awful `strcpy(ret, "[inet_ntoa error]");' and
use the proper size in inet_ntoa() definition. As for the kernel
version... it is a lost cause to argue one way or another...

 - Arnaud



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACqU3MX40tB%2BZMBTvipTuka2grPRLHLJ6WfpDdn46WScYmFpyg>