From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | andrew(at)supernews(dot)com |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Cleaning up the INET/CIDR mess |
Date: | 2006-01-25 18:08:01 |
Message-ID: | 200601251808.k0PI81d23706@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Andrew - Supernews wrote:
> On 2006-01-25, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> wrote:
> > Agreed. 10.1 as 10.0.0.1 is an old behavior which has been removed from
> > most modern versions of networking tools.
>
> Indeed so. However the current behaviour has neither the merit of being
> traditional nor the merit of being logical:
>
> => select '10.1'::cidr;
> cidr
> -------------
> 10.1.0.0/16
> (1 row)
>
> => select '128.1'::cidr;
> cidr
> --------------
> 128.1.0.0/16
> (1 row)
>
> => select '192.1'::cidr;
> cidr
> --------------
> 192.1.0.0/24
> (1 row)
>
> Having the behaviour be dependent on which part of the IP space is used
> is a total nonsense on the modern, CIDR, internet! The C in CIDR even
> stands for "Classless", so how can you ever justify introducing _new_,
> non-traditional, dependencies on the traditional classes?
This is coming from inet_net_pton.c, which we got from:
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996,1999 by Internet Software Consortium.
...
if (bits == -1)
{
if (*odst >= 240) /* Class E */
bits = 32;
else if (*odst >= 224) /* Class D */
bits = 8;
else if (*odst >= 192) /* Class C */
bits = 24;
else if (*odst >= 128) /* Class B */
bits = 16;
else
/* Class A */
bits = 8;
/* If imputed mask is narrower than specified octets, widen. */
if (bits < ((dst - odst) * 8))
bits = (dst - odst) * 8;
...
test=> select '11'::cidr;
cidr
------------
11.0.0.0/8
(1 row)
We are doing our best here to follow industry standards on how things
should behave.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Stark | 2006-01-25 18:17:22 | Re: Cleaning up the INET/CIDR mess |
Previous Message | Greg Stark | 2006-01-25 18:07:36 | Re: [PATCHES] Adding a --quiet option to initdb |