[sr-dev] IPv4 and IPv6 binary comparison

Iñaki Baz Castillo ibc at aliax.net
Wed Apr 27 15:33:19 CEST 2011


2011/4/27 Juha Heinanen <jh at tutpro.com>:
> i vote against creating yet another utils module.  since you are
> comparing texts, put it is texops module.

Hi Juha, I'm coding functions to check wheter the given string/pv is a
IPv4, IPv6, IPv6_reference, compare IP's and so. It can be used to
check a string obtained from a DB or whatever, not just from the SIP
message. Also note that checking $si (message source IP) has nothing
to do with textops module.

In fact, I'm thinking right now that the most suitable solution would
be create a library providing such functions so any other module could
internally use them (i.e. LCR for a future IPv6 addition). Opinions?


> if one address is ipv4 and the other ipv6 representation of ipv4 address
> (i think there is one), will the comparison return true?

No, it would return false. I don't see the point in comparing a IPv4
against its IPv6 representation and returning true, is it really
useful for our scenarios?


Regards.


-- 
Iñaki Baz Castillo
<ibc at aliax.net>



More information about the sr-dev mailing list