Re: Cleaning up the INET/CIDR mess

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Cleaning up the INET/CIDR mess
Дата
Msg-id 200601251808.k0PI81d23706@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: Cleaning up the INET/CIDR mess  (Andrew - Supernews <andrew+nonews@supernews.com>)
Список pgsql-hackers
Andrew - Supernews wrote:
> On 2006-01-25, Bruce Momjian <pgman@candle.pha.pa.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@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Greg Stark
Дата:
Сообщение: Re: [PATCHES] Adding a --quiet option to initdb
Следующее
От: Greg Stark
Дата:
Сообщение: Re: Cleaning up the INET/CIDR mess