Per this gripe:
http://archives.postgresql.org/pgsql-bugs/2003-11/msg00233.php
I think that the recent IPv6 changes made an undocumented and
un-agreed-to change in the semantics of netmask().

The previous behavior of netmask() was that it always delivered
a result with a masklen of 32.  It seems to me that the obvious
extension of that for IPv6 is to deliver masklen of either 32
or 128 depending on whether the input is IPv4 or IPv6.  The
actual behavior in 7.4 is that the masklen is the same as the
input value's, for example:

7.3:
regression=# select masklen(netmask('192.168.1.0/23'));
 masklen
---------
      32
(1 row)

7.4:
regression=# select masklen(netmask('192.168.1.0/23'));
 masklen
---------
      23
(1 row)

The previous behavior had been agreed to at one point:
http://archives.postgresql.org/pgsql-hackers/2000-10/msg01132.php
I can't find anyplace in the archives where the change was discussed
at all.

hostmask() was not in 7.3 so its behavior is a bit up for grabs,
but I think it ought to return the same masklen as netmask().

Comments?

			regards, tom lane

Sun, 30 Nov 2003 23:06:55 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Wrong masklen in result of netmask()/hostmask()
Tom Lane wrote:
> The previous behavior had been agreed to at one point:
> http://archives.postgresql.org/pgsql-hackers/2000-10/msg01132.php
> I can't find anyplace in the archives where the change was discussed
> at all.
> 
> hostmask() was not in 7.3 so its behavior is a bit up for grabs,
> but I think it ought to return the same masklen as netmask().

Yep, I am sure it was an oversight.  Seems like a good candidate for
7.4.1.

-- 
  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, Pennsylvania 19073

Sun, 30 Nov 2003 23:11:45 -0500 (EST)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: Wrong masklen in result of netmask()/hostmask()