Andrew - Supernews wrote:
> On 2006-01-25, Bruce Momjian <[email protected]> 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
[email protected] | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match