A postgresql inet to ip6.arpa snippet

Ignatios Souvatzis ignatios at cs.uni-bonn.de
Wed Jul 27 17:31:32 CEST 2011


On Wed, Jul 27, 2011 at 03:16:00PM +0100, Nick Hilliard wrote:
> On 27/07/2011 15:03, Ignatios Souvatzis wrote:
> >On Wed, Jul 27, 2011 at 01:38:13PM +0000, Erik Kline wrote:
> >>>The icing on the cake would be to support CIDR for this; i.e. if I specify
> >>>2001:db8::/32 then it becomes 8.b.d.0.1.0.0.2.ip6.arpa
> >>
> >>What should it do for a prefix with a CIDR len that doesn't fall on a
> >>nibble boundary?  E.g., what should it produce for 2001:db8::/31, and
> >>/33?
> >
> >Throw an exception.
> 
> o_O
> 
> That may be the "correct" approach to deal with the problem, but srsly...

well, then: always return a list of (one, two, four or eight)
addresses, e.g.:

"2001:db8::/32" -> ("8.b.d.0.1.0.0.2.ip6.arpa")
"2001:db8::/35" -> ("0.8.b.d.0.1.0.0.2.ip6.arpa" "1.8.b.d.0.1.0.0.2.ip6.arpa")

Regards,
	-is




More information about the ipv6-ops mailing list