plpgsql -- any '+' ,'-' operators for INET?
Started by Randall Perryabout 21 years ago1 messagesgeneral
Anyone know an easy way to increment IP type inet?
For example, I'd like to create a list of all Ips contained in a subnet. For
that, I can grab the network address and broadcast address from a given CIDR
subnet type, and then fill in all the Ips between the two.
I know I can:
* convert an INET addr to text using host()
* grep the digits after the last period (for class C addresses, anyway)
* convert that to an integer
* increment the integer
* concatenate it after the 1st 3 sets of digits in the address to produce
the next ip
Just wondering if there's an easier way, or anyone has written a function to
handle this?
--
Randall Perry
sysTame
Xserve Web Hosting/Co-location
Website Development/Promotion
Mac Consulting/Sales