3
3
*is for IP V4 CIDR notation, but prepared for V6: just
4
4
*add the necessary bits where the comments indicate.
5
5
*
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 $
7
7
*Jon Postel RIP 16 Oct 1998
8
8
*/
9
9
@@ -395,9 +395,9 @@ network_network(inet *ip)
395
395
if (ip_family (ip )== AF_INET )
396
396
{
397
397
/* 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 )
401
401
{
402
402
elog (ERROR ,"unable to print network (%s)" ,strerror (errno ));
403
403
return (NULL );
@@ -409,8 +409,6 @@ network_network(inet *ip)
409
409
elog (ERROR ,"unknown address family (%d)" ,ip_family (ip ));
410
410
return (NULL );
411
411
}
412
- if ((ptr = strchr (tmp ,'/' ))!= NULL )
413
- * ptr = 0 ;
414
412
len = VARHDRSZ + strlen (tmp )+ 1 ;
415
413
ret = palloc (len );
416
414
if (ret == NULL )