aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1999-02-24 03:17:05 +0000
committerBruce Momjian <bruce@momjian.us>1999-02-24 03:17:05 +0000
commit02fa3e439429b5ff9d74bf76d5b94e2aff150667 (patch)
tree32500704096cf5ac3498a6d088c645b10369c95f
parentfa9db42a6e59701e734cf00d2c9e21a40834ad3a (diff)
downloadpostgresql-02fa3e439429b5ff9d74bf76d5b94e2aff150667.tar.gz
postgresql-02fa3e439429b5ff9d74bf76d5b94e2aff150667.zip
Thank you for the advice. I concluded that current inet code has a
portability problem. Included patches should be applied to both current and 6.4 tree. I have tested on LinuxPPC, FreeBSD and Solaris 2.6. Now the inet regression tests on these platforms are all happy. --- Tatsuo Ishii
-rw-r--r--src/backend/utils/adt/network.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/backend/utils/adt/network.c b/src/backend/utils/adt/network.c
index bb2d9070e6a..fbe087f7b3f 100644
--- a/src/backend/utils/adt/network.c
+++ b/src/backend/utils/adt/network.c
@@ -3,7 +3,7 @@
* is for IP V4 CIDR notation, but prepared for V6: just
* add the necessary bits where the comments indicate.
*
- * $Id: network.c,v 1.5 1999/01/01 04:17:13 momjian Exp $
+ * $Id: network.c,v 1.6 1999/02/24 03:17:05 momjian Exp $
* Jon Postel RIP 16 Oct 1998
*/
@@ -356,7 +356,12 @@ network_broadcast(inet *ip)
if (ip_family(ip) == AF_INET)
{
/* It's an IP V4 address: */
- int addr = htonl(ntohl(ip_v4addr(ip)) | (0xffffffff >> ip_bits(ip)));
+ int addr;
+ unsigned long mask = 0xffffffff;
+
+ if (ip_bits(ip) < 32)
+ mask >>= ip_bits(ip);
+ addr = htonl(ntohl(ip_v4addr(ip)) | mask);
if (inet_net_ntop(AF_INET, &addr, 32, tmp, sizeof(tmp)) == NULL)
{