Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] cidr

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: darcy(at)druid(dot)net (D'Arcy J(dot)M(dot) Cain)
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] cidr
Date: 1998-07-24 04:14:03
Message-ID: 199807240414.AAA07207@candle.pha.pa.us (view raw or flat)
Thread:
Lists: 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(at)candle(dot)pha(dot)pa(dot)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)

In response to

Responses

pgsql-hackers by date

Next:From: The Web AdministratorDate: 1998-07-24 04:22:17
Subject: Re: [GENERAL] Re: [HACKERS] [Fwd: SGVLLUG Oracle and Informix on Linux]
Previous:From: Ken McGlothlenDate: 1998-07-24 03:53:37
Subject: Re: [GENERAL] Re: [HACKERS] [Fwd: SGVLLUG Oracle and Informix on Linux]

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group