Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3fe6a77

Browse files
committed
Fix for funcs on INET/CIDR.
1 parent 2ba4ee7 commit 3fe6a77

File tree

3 files changed

+47
-9
lines changed

3 files changed

+47
-9
lines changed

src/backend/utils/adt/inet.c

Lines changed: 25 additions & 1 deletion
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: inet.c,v 1.10 1998/10/22 00:35:23 momjian Exp $
6+
* $Id: inet.c,v 1.11 1998/10/22 04:58:07 momjian Exp $
77
* Jon Postel RIP 16 Oct 1998
88
*/
99

@@ -355,12 +355,24 @@ inet_host(inet *ip)
355355
return (ret);
356356
}
357357

358+
text *
359+
cidr_host(inet *ip)
360+
{
361+
inet_host(ip);
362+
}
363+
358364
int4
359365
inet_netmasklen(inet *ip)
360366
{
361367
return ip_bits(ip);
362368
}
363369

370+
int4
371+
cidr_netmasklen(inet *ip)
372+
{
373+
return inet_netmasklen(ip);
374+
}
375+
364376
text *
365377
inet_broadcast(inet *ip)
366378
{
@@ -402,6 +414,12 @@ inet_broadcast(inet *ip)
402414
return (ret);
403415
}
404416

417+
text *
418+
cidr_broadcast(inet *ip)
419+
{
420+
inet_broadcast(ip);
421+
}
422+
405423
text *
406424
inet_netmask(inet *ip)
407425
{
@@ -441,6 +459,12 @@ inet_netmask(inet *ip)
441459
return (ret);
442460
}
443461

462+
text *
463+
cidr_netmask(inet *ip)
464+
{
465+
inet_netmask(ip);
466+
}
467+
444468
/*
445469
* Bitwise comparison for V4 addresses. Add V6 implementation!
446470
*/

src/include/catalog/pg_proc.h

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: pg_proc.h,v 1.77 1998/10/22 00:35:25 momjian Exp $
9+
* $Id: pg_proc.h,v 1.78 1998/10/22 04:58:09 momjian Exp $
1010
*
1111
* NOTES
1212
* The script catalog/genbki.sh reads this file and generates .bki
@@ -2104,7 +2104,7 @@ DESCR("is-supernet");
21042104
DATA(insert OID = 930 ( inet_supeq PGUID 11 f t f 2 f 16 "869 869" 100 0 0 100 foo bar ));
21052105
DESCR("is-supernet-or-equal");
21062106

2107-
/* inet/cidr base versions */
2107+
/* inet base versions */
21082108
DATA(insert OID = 940 ( inet_netmask PGUID 11 f t f 1 f 25 "869" 100 0 0 100 foo bar ));
21092109
DESCR("netmask of address");
21102110
DATA(insert OID = 941 ( inet_netmasklen PGUID 11 f t f 1 f 23 "869" 100 0 0 100 foo bar ));
@@ -2114,6 +2114,16 @@ DESCR("broadcast address");
21142114
DATA(insert OID = 682 ( inet_host PGUID 11 f t f 1 f 25 "869" 100 0 0 100 foo bar ));
21152115
DESCR("host address");
21162116

2117+
/* cidr base versions */
2118+
DATA(insert OID = 1619 ( cidr_netmask PGUID 11 f t f 1 f 25 "650" 100 0 0 100 foo bar ));
2119+
DESCR("netmask of address");
2120+
DATA(insert OID = 1620 ( cidr_netmasklen PGUID 11 f t f 1 f 23 "650" 100 0 0 100 foo bar ));
2121+
DESCR("netmask length");
2122+
DATA(insert OID = 1621 ( cidr_broadcast PGUID 11 f t f 1 f 25 "650" 100 0 0 100 foo bar ));
2123+
DESCR("broadcast address");
2124+
DATA(insert OID = 1622 ( cidr_host PGUID 11 f t f 1 f 25 "650" 100 0 0 100 foo bar ));
2125+
DESCR("host address");
2126+
21172127
/* inet versions */
21182128
DATA(insert OID = 946 ( netmask PGUID 14 f t f 1 f 25 "869" 100 0 0 100 "select inet_netmask($1)" - ));
21192129
DESCR("netmask of address");
@@ -2125,17 +2135,16 @@ DATA(insert OID = 949 ( host PGUID 14 f t f 1 f 25 "869" 100 0 0 100 "select
21252135
DESCR("host address");
21262136

21272137
/* cidr versions */
2128-
DATA(insert OID = 696 ( netmask PGUID 14 f t f 1 f 25 "650" 100 0 0 100 "select inet_netmask($1)" - ));
2138+
DATA(insert OID = 696 ( netmask PGUID 14 f t f 1 f 25 "650" 100 0 0 100 "select cidr_netmask($1)" - ));
21292139
DESCR("netmask of address");
2130-
DATA(insert OID = 697 ( netmasklen PGUID 14 f t f 1 f 23 "650" 100 0 0 100 "select inet_netmasklen($1)" - ));
2140+
DATA(insert OID = 697 ( netmasklen PGUID 14 f t f 1 f 23 "650" 100 0 0 100 "select cidr_netmasklen($1)" - ));
21312141
DESCR("netmask length");
2132-
DATA(insert OID = 698 ( broadcast PGUID 14 f t f 1 f 25 "650" 100 0 0 100 "select inet_broadcast($1)" - ));
2142+
DATA(insert OID = 698 ( broadcast PGUID 14 f t f 1 f 25 "650" 100 0 0 100 "select cidr_broadcast($1)" - ));
21332143
DESCR("broadcast address");
2134-
DATA(insert OID = 699 ( host PGUID 14 f t f 1 f 25 "650" 100 0 0 100 "select inet_host($1)" - ));
2144+
DATA(insert OID = 699 ( host PGUID 14 f t f 1 f 25 "650" 100 0 0 100 "select cidr_host($1)" - ));
21352145
DESCR("host address");
21362146

21372147

2138-
21392148
/*
21402149
* prototypes for functions pg_proc.c
21412150
*/

src/include/utils/builtins.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: builtins.h,v 1.64 1998/10/22 00:35:28 momjian Exp $
9+
* $Id: builtins.h,v 1.65 1998/10/22 04:58:11 momjian Exp $
1010
*
1111
* NOTES
1212
* This should normally only be included by fmgr.h.
@@ -542,6 +542,11 @@ int4 inet_netmasklen(inet * addr);
542542
text *inet_broadcast(inet * addr);
543543
text *inet_host(inet * addr);
544544

545+
text *cidr_netmask(inet * addr);
546+
int4 cidr_netmasklen(inet * addr);
547+
text *cidr_broadcast(inet * addr);
548+
text *cidr_host(inet * addr);
549+
545550

546551
/* mac.c */
547552
macaddr *macaddr_in(char *str);

0 commit comments

Comments
 (0)