[OpenSIPS-Devel] New Transformations Available

Vlad Paiu vladpaiu at opensips.org
Wed Aug 18 11:03:44 CEST 2010


Hello Thomas,

The IP transformations currently return the binary format of the IPs in 
a string format, to keep compatibility with both IPv4 and IPv6. The 
bitwise operators in OpenSIPS currently only work with
integers. We are now expanding the bitwise operators to also work with 
string variables, and a fix will be committed as soon as we finish.

Regards,

On 08/17/2010 10:44 PM, Thomas Gelf wrote:
> Hey, that's great!
>
> Please feel free to close my corrsponding feature request #3028431 ;-)
> This should finally allow to check for example whether a Contact uri
> points to a specific subnet (security checks!). The following example
> shall deny REGISTER requests with Contacts pointing to your own network
> (e.g. 192.0.2.128/25):
>
> if ($ct{uri.host}{ip.isip}) {
>    if (($ct{uri.host}{ip.pton}&  "255.255.255.128"{ip.pton}) ==
> "192.0.2.128"{ip.pton}) {
>      xlog("L_ERR", "Rejecting REGISTER pointing to OURNET");
>      send_reply("403", "Invalid Contact");
>      exit;
>    }
> }
>
> Please note that this is just a really simple example, a full check
> would have to loop through ALL provided Contacts.
>
> Vlad: I didn't test it yet, but I guess it should work that way,
> shouldn't it?
>
> Best regards,
> Thomas Gelf
>
> Am 17.08.2010 17:30, schrieb Vlad Paiu:
>    
>> The ip transformations add the possibility to store a string
>> representation of an IP into a binary format, and the other way round.
>> You can also check if a string is a valid IP address, get the family of
>> a binary IP representation ( INET or INET6 ) and resolve a domain name
>> to get its corresponding string IP address.
>> ...
>> For more extended examples of using the newly available transformations,
>> visit http://www.opensips.org/Resources/DocsCoreTran .
>>      
>
>    


-- 
Paiu Vlad
www.voice-system.ro




More information about the Devel mailing list