Fix several issues with adding IP ranges

* Prevents non-adjacent ranges from being added
* Prevents creating invalid subnets
* Fixes a bug where the integer value of an IPv6 address that is less than
  32 bits would be treated as an IPv4 address during addition.