On 4/28/11 10:55 AM, Henning Westerholt wrote:
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.
It is not text comparison and textops has the purpose of working on generic text, not on conceptual attributes, otherwise siptutils and many other modules can be just merged there.
Note that the module will be extended to do dns queries and provide the result (very likely through PV) to configuration file. Then it gets messy reusing the code of another module. Also for checking network addresses there must be binary operations behind.
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) {..}
This is not working, if you have a pseudo-variable in the right side, then it is string comparison. The IP/Net address comparison with '==' works only for the keywords like src_ip, dst_ip, snd_ip, to_ip - look where is used comp_ip() in route.c .
So a new module is very appropriate and cleaner in my opinion -- there is no need to load unnecessary code when not needed as part of existing module -- and here is a clear group of many potential extensions. At the end of the day, there is no conflict to decide here, it is up to developer how it prefers to add a new thing, since it is his time and his copyright. A new ipops (or dnsops) module will get in at some time, for sure when I am going to implement the planned DNS stuff.
Cheers, Daniel
if ($si == 192.168.1.1) {..}
it could do this binary comparison inside as well for v6.
Henning
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev