1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-28 18:48:04 +03:00

Clean up the INET-vs-CIDR situation. Get rid of the internal is_cidr flag

and rely exclusively on the SQL type system to tell the difference between
the types.  Prevent creation of invalid CIDR values via casting from INET
or set_masklen() --- both of these operations now silently zero any bits
to the right of the netmask.  Remove duplicate CIDR comparison operators,
letting the type rely on the INET operators instead.
This commit is contained in:
Tom Lane
2006-01-26 02:35:51 +00:00
parent 5997386a0a
commit 8d8bf12760
12 changed files with 274 additions and 147 deletions

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/utils/inet.h,v 1.21 2006/01/23 21:45:47 momjian Exp $
* $PostgreSQL: pgsql/src/include/utils/inet.h,v 1.22 2006/01/26 02:35:51 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -22,7 +22,6 @@ typedef struct
{
unsigned char family; /* PGSQL_AF_INET or PGSQL_AF_INET6 */
unsigned char bits; /* number of bits in netmask */
bool is_cidr; /* is cidr? */
unsigned char ipaddr[16]; /* up to 128 bits of address */
} inet_struct;