Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdabc3f3

Browse files
committed
Fix for netmask('x.x.x.x/0') is 255.255.255.255 instead of 0.0.0.0
This is because (-1) << 32 is -1 (Only intel arc. has been checked)Oleg Sharoiko
1 parent337ab80 commitdabc3f3

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

‎doc/TODO

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ PARSER
4848
* redesign INSERT ... SELECT to have two levels of target list
4949
* -select * from pg_class where oid in (0,-1)
5050
* have INTERSECT/EXCEPT prevent duplicates unless ALL is specified
51+
* prevent primary key of nine columns(see TODO.detail/primary)
5152

5253
VIEWS
5354

‎src/backend/utils/adt/network.c

Lines changed: 3 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.15 1999/07/17 20:17:58 momjian Exp $
6+
*$Id: network.c,v 1.16 1999/09/2317:42:23 momjian Exp $
77
*Jon Postel RIP 16 Oct 1998
88
*/
99

@@ -448,7 +448,8 @@ network_netmask(inet *ip)
448448
if (ip_family(ip)==AF_INET)
449449
{
450450
/* It's an IP V4 address: */
451-
intaddr=htonl((-1 << (32-ip_bits(ip)))&0xffffffff);
451+
intaddr=htonl(ip_bits(ip) ?
452+
(-1 << (32-ip_bits(ip)))&0xffffffff :0x00000000);
452453

453454
if (inet_net_ntop(AF_INET,&addr,32,tmp,sizeof(tmp))==NULL)
454455
elog(ERROR,"unable to print netmask (%s)",strerror(errno));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp