Re: git: fbe0257b5613 - main - libc/resolv: Reimplement the sortlist parser

From: Dag-Erling_Smørgrav <des_at_FreeBSD.org>
Date: Sun, 19 Jul 2026 12:09:17 UTC
Dag-Erling Smørgrav <des@FreeBSD.org> writes:
> "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net> writes:
> > one could likely make the blocks above and below even simpler if one used
> > inet_cidr_pton(), which will also deal with the mask, so one does not have
> > to parse it away and checking it onself per-AF.
> inet_cidr_pton() is undocumented, so it might as well not exist.

In addition to being undocumented and having a gratuitously different
return value scheme than inet_pton(), inet_cidr_pton() is incapable of
correctly parsing trivial cases such as:

* ::/0 incorrectly parsed as ::/-1
    
* 0.0.0.0/0 incorrectly parsed as either ::/128 or 0.0.0.0/32 depending
  on which AF you try

* 2001:db8::/32 incorrectly parsed as 2001:db8::/-1

DES
-- 
Dag-Erling Smørgrav - des@FreeBSD.org