[sr-dev] IPv4 and IPv6 binary comparison
Iñaki Baz Castillo
ibc at aliax.net
Thu Apr 28 11:27:01 CEST 2011
2011/4/28 Henning Westerholt <henning.westerholt at 1und1.de>:
> Hello,
>
> i like to also not see much more of this small utility modules, in the end its
> just a text operation, as you've said.
Ok. I'm coding it right now in a new module but just for testing
purposes (which is easier than modify existing core parts).
> Another question, have you thought about extending the existing "equals"
> operator that it works also for IPv6 address? Just like for IPv4 addresses
> where it already understands network masks, e.g.:
>
> if ($si == 192.168.1.1/32) {..}
> if ($si == 192.168.1.1) {..}
>
> it could do this binary comparison inside as well for v6.
Interesting. However, in case the second argument is a pv (i.e.
retrieved from a DB) "equal" operator would not work as expected, am I
right?
This is the reason I'm coding a function "compare_ips" which allow
IPv4, IPv6, IPv6-reference (string or pv).
Maybe another function could be created: is_ip_in(IP, NETWORK)
--
Iñaki Baz Castillo
<ibc at aliax.net>
More information about the sr-dev
mailing list