Skip to content

Commit 02fa3e4

Browse files
committed
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
1 parent fa9db42 commit 02fa3e4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/backend/utils/adt/network.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
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.5 1999/01/01 04:17:13 momjian Exp $
6+
* $Id: network.c,v 1.6 1999/02/24 03:17:05 momjian Exp $
77
* Jon Postel RIP 16 Oct 1998
88
*/
99

@@ -356,7 +356,12 @@ network_broadcast(inet *ip)
356356
if (ip_family(ip) == AF_INET)
357357
{
358358
/* It's an IP V4 address: */
359-
int addr = htonl(ntohl(ip_v4addr(ip)) | (0xffffffff >> ip_bits(ip)));
359+
int addr;
360+
unsigned long mask = 0xffffffff;
361+
362+
if (ip_bits(ip) < 32)
363+
mask >>= ip_bits(ip);
364+
addr = htonl(ntohl(ip_v4addr(ip)) | mask);
360365

361366
if (inet_net_ntop(AF_INET, &addr, 32, tmp, sizeof(tmp)) == NULL)
362367
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy