in reply to Storing and searching sets of IP address ranges

If each entry of the set is a nonoverlapping range of IP addresses, i would keep them in a sorted list of ranges.
A given ip address can be found by bisecting on the start of each range followed by a check that the address is smaller or equal to its highest value.

If you want to use strings for IP addresses, bitwise string operators may be of help if you need to mask out the subnet with the netmask value for the range.

  • Comment on Re: Storing and searching sets of IP address ranges