Re: [GENERAL] status on IPv6 implementation... - Mailing list pgsql-general

From Tom Ivar Helbekkmo
Subject Re: [GENERAL] status on IPv6 implementation...
Date
Msg-id 863e90zx3b.fsf@athene.nhh.no
Whole thread Raw
In response to Re: [GENERAL] status on IPv6 implementation...  (Lorenzo Huerta <lorenzo@nmsu.edu>)
List pgsql-general
Lorenzo Huerta <lorenzo@nmsu.edu> writes:

> Does it treat the ip as text, or numeric value?

Neither.  It handles IPV4 CIDRs, of which host addresses are a special
case, as just what they are.  Input and output are textual, of course.
The internal storage format looks like this:

typedef struct {
  unsigned char family;        /* AF_INET (or, soon, AF_INET6) */
  unsigned char bits;        /* CIDR prefix length */
  union {
    u_int32_t ipv4_addr;    /* network byte order */
                /* add IPV6 address type here */
  } addr;
} ipaddr_struct;

Oh, and the actual method of storage in the database is variable
length, so even when IPV6 code is added, the IPV4 storage format won't
change in size or layout.

-tih
--
Popularity is the hallmark of mediocrity.  --Niles Crane, "Frasier"

pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [GENERAL] Regex problems
Next
From: Andrea Antibo
Date:
Subject: Re: [GENERAL] make[2]: *** [psql] Error 1