[sr-dev] IPv4 and IPv6 binary comparison

Henning Westerholt henning.westerholt at 1und1.de
Thu Apr 28 10:55:46 CEST 2011


On Wednesday 27 April 2011, Juha Heinanen wrote:
> Iñaki Baz Castillo writes:
> > Hi Juha. After reviewing it, it seems that ip_addr.h just contains
> > functions to operate with IP/socket structs rather than text
> > representations, so it's not exactly what I need.
> > 
> > So please let me initially create a module "ipops" with the suggested
> > functions. Later we can discuss how to move it into a library or
> > ip_addr.h.
> 
> i still don't like the idea of having yet another module.  if you
> operate on text (as you say in above), i don't see what is wrong with
> textops module or existing utils module.

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.

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.

Henning



More information about the sr-dev mailing list