inet_net_pton() alternative for IPv6

Ian Pilcher arequipeno@gmail.com
Tue Jul 5 23:58:00 GMT 2022


On 7/4/22 13:23, tomas@tuxteam.de wrote:
> I never tried it, but this is what my version [1] of the libc docs say:
> 
>   -- Function: int inet_pton (int AF, const char *CP, void *BUF)
> 
>       Preliminary: | MT-Safe locale | AS-Safe | AC-Safe | *Note POSIX
>       Safety Concepts::.
> 
>       This function converts an Internet address (either IPv4 or IPv6)
>       from presentation (textual) to network (binary) format.  AF should
>       be either ‘AF_INET’ or ‘AF_INET6’, as appropriate for the type of
>       address being converted.  CP is a pointer to the input string, and
>       BUF is a pointer to a buffer for the result.  It is the caller’s
>       responsibility to make sure the buffer is large enough.


You're looking at the wrong function.  inet_pton() does support IPv6;
inet_net_pton() does not (even though its interface is designed in a
way that it could accomodate it).

-- 
========================================================================
Google                                      Where SkyNet meets Idiocracy
========================================================================


More information about the Libc-help mailing list