Re: PATCH: Disallow a netmask of zero unless the IP is also all zeroes

From: Andreas Karlsson <andreas(at)proxel(dot)se>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Greg Sabino Mullane <htamfids(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PATCH: Disallow a netmask of zero unless the IP is also all zeroes
Date: 2025-02-14 11:41:19
Message-ID: a87da13e-82e2-46db-ad61-8cfbd8840afd@proxel.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2/11/25 9:25 PM, Tom Lane wrote:
> Greg Sabino Mullane <htamfids(at)gmail(dot)com> writes:
>> I say "of course" but few people (even tech ones) know the distinction.
>> (Nor should they have to! But that's for a nearby thread). This patch aims
>> to prevent this very bad footgun by only allowing a /0 if the IP consists
>> of only zeroes. It works for ipv4 and ipv6.
>
> More generally, should we reject if the netmask causes *any* nonzero
> IP bits to be ignored? Our CIDR type already imposes that rule:

+1 From me too. I think we should fix the general issue rather than
special casing /0.

Andreas

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2025-02-14 11:46:49 Re: Assignment before assert
Previous Message Anton A. Melnikov 2025-02-14 11:40:52 Re: Change GUC hashtable to use simplehash?