33 *is for IP V4 CIDR notation, but prepared for V6: just
44 *add the necessary bits where the comments indicate.
55 *
6- *$Id: network.c,v 1.2 1998/10/26 01:03:24 tgl Exp $
6+ *$Id: network.c,v 1.3 1998/10/29 04:41:44 momjian Exp $
77 *Jon Postel RIP 16 Oct 1998
88 */
99
@@ -395,9 +395,9 @@ network_network(inet *ip)
395395if (ip_family (ip )== AF_INET )
396396{
397397/* It's an IP V4 address: */
398- int addr = ntohl (ip_v4addr (ip ))& (0xffffffff << (32 - ip_bits (ip )));
399-
400- if (inet_cidr_ntop (AF_INET ,& addr ,32 ,tmp ,sizeof (tmp ))== NULL )
398+ int addr = htonl ( ntohl (ip_v4addr (ip ))& (0xffffffff << (32 - ip_bits (ip ) )));
399+
400+ if (inet_cidr_ntop (AF_INET ,& addr ,ip_bits ( ip ) ,tmp ,sizeof (tmp ))< 0 )
401401{
402402elog (ERROR ,"unable to print network (%s)" ,strerror (errno ));
403403return (NULL );
@@ -409,8 +409,6 @@ network_network(inet *ip)
409409elog (ERROR ,"unknown address family (%d)" ,ip_family (ip ));
410410return (NULL );
411411}
412- if ((ptr = strchr (tmp ,'/' ))!= NULL )
413- * ptr = 0 ;
414412len = VARHDRSZ + strlen (tmp )+ 1 ;
415413ret = palloc (len );
416414if (ret == NULL )