Migrate from GitHub to SourceForge with this tool. Check out all of SourceForge's recent improvements.

#55 Binary IP address representation

core (12)
Thomas Gelf

Right now IP addresses are only available as strings in your OpenSIPS config file. This makes checks whether an IP is in a specific subnet pretty tricky, especially with custom/classless subnet masks and with IPv6.

I would suggest to add a new "namespace" for transformations, called "ip". Valid new transformations could be:

{s.pton} -> get binary IP address representation (can be 4 or 16 bytes long!)
{s.isip} -> given string is a valid IP address
{ip.family} or {ip.protocol} -> INET or INET6
{ip.ntop} -> get string representation from an IP address
{uri.host.ip} -> get an IP address for a given host, do a DNS lookup if required

This is just one possibly way of how it could be done, please feel free to modify the examples to make them fit OpenSIPS's core transformation logic.

Best regards,
Thomas Gelf


  • Bogdan-Andrei Iancu

    • assigned_to: nobody --> vladut-paiu
    • status: open --> closed

Log in to post a comment.