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

Commite47b93d

Browse files
committed
The INET and CIDR types mistakenly compared 198.68.123.0/24 and
198.68.123.0/27 the same when indexing them.D'Arcy
1 parent8593e1f commite47b93d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

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

Lines changed: 10 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.9 1999/05/25 16:12:11 momjian Exp $
6+
*$Id: network.c,v 1.10 1999/06/02 03:37:15 momjian Exp $
77
*Jon Postel RIP 16 Oct 1998
88
*/
99

@@ -306,8 +306,16 @@ network_cmp(inet *a1, inet *a2)
306306
{
307307
if (ntohl(ip_v4addr(a1))<ntohl(ip_v4addr(a2)))
308308
return (-1);
309-
elseif (ntohl(ip_v4addr(a1))>ntohl(ip_v4addr(a2)))
309+
310+
if (ntohl(ip_v4addr(a1))>ntohl(ip_v4addr(a2)))
311+
return (1);
312+
313+
if (ip_bits(a1)<ip_bits(a2))
314+
return (-1);
315+
316+
if (ip_bits(a1)>ip_bits(a2))
310317
return (1);
318+
311319
return0;
312320
}
313321

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp