Re: [HACKERS] cidr

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: [HACKERS] cidr
Дата
Msg-id 199807240414.AAA07207@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] cidr  (darcy@druid.net (D'Arcy J.M. Cain))
Ответы Re: [HACKERS] cidr  (darcy@druid.net (D'Arcy J.M. Cain))
Список pgsql-hackers
> I thought that that was the idea to begin with.
>
> >     192.0.0.3/24    cidr
> Right.
>
> >     192.0.0.3:255.255.0.0   host/netmask
> Converted internally to 192.0.0.3:/16

This is a problem.  Suppose you have:

    192.0.0.0:255.255.255.0

This is a host with netmask, while:

    192.0.0.0/24

is a network address.  Paul?

>
> >     192.0.0.3    host, implied netmask A,B,C class?
> Letting this convert automatically to a C class may not be what was
> desired.  Better to specify the netmask.  You may be subnetting it
> or even supernetting it.
>
> >     192.0.0.3/32    host?
> I would suggest that 192.0.0.3 should be the same thing unless we have
> a mask len of -1 to signal indeterminate mask length in which case
> 192.0.0.3 gets converted internally to 192.0.0.3/-1.  Further, printing
> a cidr with mask len of 32 (or -1) should print as if the host function
> were called, that is don't print the network info in such cases.


Yep.

>
> >     192.0.0.3/32:255.255.255.0  host?/netmask
> But 192.0.0.3/24 or 192.0.0.3:255.255.255.0 gives all the information
> that you need.

See example above.  You use the 3 here to know it is a host, because the
IP address extens past the netmask, but what if they are zeros?

> You mean printing netmasks?  As I said, it seems to me that netmasks will
> always be paired with a host or network but perhaps we can set up the
> function table so that netmask on an integer type converts to a netmask
> in the form you suggest.  That would be the truly oo way to do it.

Certainly we could, but it seems nice to have one type just for ip-type
stuff.


--
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)

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

Предыдущее
От: darcy@druid.net (D'Arcy J.M. Cain)
Дата:
Сообщение: Re: [HACKERS] cidr
Следующее
От: Brandon Ibach
Дата:
Сообщение: CIDR type