New Transformations Available

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

New Transformations Available

Vlad Paiu
Hello all,

    Three new transformations have been added to OpenSIPS: IP, CSV and SDP.
    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.
    The csv transformations add the possibility to count the number of
entries in a CSV record or fetch the value of an entry inside a CSV record.
    The sdp transformations add the possibility to fetch a single line
from a SDP body.

    For more extended examples of using the newly available
transformations, visit http://www.opensips.org/Resources/DocsCoreTran .

Regards,

--
Paiu Vlad
www.voice-system.ro


_______________________________________________
Devel mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: New Transformations Available

Thomas Gelf
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 .


--
 mail: [hidden email]
  web: http://thomas.gelf.net/



_______________________________________________
Devel mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: New Transformations Available

Vlad Paiu
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


_______________________________________________
Devel mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: New Transformations Available

Thomas Gelf
Am 18.08.2010 11:03, schrieb Vlad Paiu:
> The IP transformations currently return the binary format of the IPs in
> a string format, to keep compatibility with both IPv4 and IPv6.

Makes absolutely sense :)

> 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.

This has been my doubt :p Bitwise operators working with string
variables would be great, I'll stay tuned!

Regards,
Thomas

--
 mail: [hidden email]
  web: http://thomas.gelf.net/



_______________________________________________
Devel mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: New Transformations Available

Alex Massover
In reply to this post by Vlad Paiu
Hi,

Cool! Will it be backported to 1.6?

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Vlad Paiu
Sent: Tuesday, August 17, 2010 6:31 PM
To: [hidden email]; [hidden email]; [hidden email]
Subject: [OpenSIPS-Devel] New Transformations Available

Hello all,

    Three new transformations have been added to OpenSIPS: IP, CSV and SDP.
    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.
    The csv transformations add the possibility to count the number of
entries in a CSV record or fetch the value of an entry inside a CSV record.
    The sdp transformations add the possibility to fetch a single line
from a SDP body.

    For more extended examples of using the newly available
transformations, visit http://www.opensips.org/Resources/DocsCoreTran .

Regards,

--
Paiu Vlad
www.voice-system.ro


_______________________________________________
Devel mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel

This mail was received via Mail-SeCure System.



This mail was sent via Mail-SeCure System.
_______________________________________________
Devel mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: New Transformations Available

Vlad Paiu
In reply to this post by Thomas Gelf
Hello,

I have committed a new version that allows bitwise operations for string
variables.
It is now possible to do something like this, from the OpenSIPS script :

$var(mask) = "255.255.0.0";
$var(ip) = "192.168.2.134";
$var(net) = $(var(mask){ip.pton}) & $(var(ip){ip.pton});

if ($(var(net){ip.ntop}) == "192.168.0.0")
     xlog("IP is in 192.168.0.0/16 network\n");

As for back-porting to 1.6, it will be done, but only after more
testing, when we will be sure that the version is stable.

Regards,

On 08/18/2010 01:20 PM, Thomas Gelf wrote:

> Am 18.08.2010 11:03, schrieb Vlad Paiu:
>    
>> The IP transformations currently return the binary format of the IPs in
>> a string format, to keep compatibility with both IPv4 and IPv6.
>>      
> Makes absolutely sense :)
>
>    
>> 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.
>>      
> This has been my doubt :p Bitwise operators working with string
> variables would be great, I'll stay tuned!
>
> Regards,
> Thomas
>
>    


--
Paiu Vlad
www.voice-system.ro


_______________________________________________
Devel mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel