Re: [OpenSIPS-Users] Preventing invalid packet parsing

2016-06-28 Thread Bogdan-Andrei Iancu

Hi,

Well, if the "message" got to the script level, it means is "looks" like 
a SIP message - to reach the script, the message must have a SIP valid 
first line and Top most VIA.


So, if your "bogus" messages do not have anything to do with SIP, 
considering actions at script level is a non sense as it is too late. 
What you can do is to rely on the size of the package in order to drop 
it (by default, OpenSIPS drops any UDP packet shorter than 20 bytes - 
see MIN_UDP_PACKET in config.h). You can change that value to match your 
needs. And recompile.


IF the incoming traffic looks like SIP packages (and it lands in your 
script), you should use the sipmsg_validate() to get ready of it asap. 
It is not about processing, it is more about avoid polluting the logs 
with errors :)


Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 28.06.2016 18:06, Owais Ahmad wrote:
Thats not the case Alex. But I am expecting a large number of UDP 
messages arriving on the same port as my udp listening socket.

Just want to be sure there is no wasteful work done parsing such packets.

On Tue, Jun 28, 2016 at 8:04 PM, Alex Balashov 
> wrote:


Are you under the impression that these consume a significant
amount of OpenSIPS resources? If so, how did you arrive at that
conclusion?

On 06/28/2016 11:02 AM, Owais Ahmad wrote:

Hello,

I am getting UDP (non-SIP) packets on opensips listening port.
How can I
drop those packets to ensure it only consumes the least
opensips resources.

I do have mechanisms to prevent this on the firewall but just
want to be
sure that if such a network packet does reach the server, opensips
doesn't end up parsing it assuming its SIP.

I want to do this without using: sipmsg_validate





Regards,
Owais


___
Users mailing list
Users@lists.opensips.org 
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



-- 
Alex Balashov | Principal | Evariste Systems LLC

1447 Peachtree Street NE, Suite 700
Atlanta, GA 30309
United States

Tel: +1-800-250-5920  (toll-free) /
+1-678-954-0671  (direct)
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/

___
Users mailing list
Users@lists.opensips.org 
http://lists.opensips.org/cgi-bin/mailman/listinfo/users




___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Preventing invalid packet parsing

2016-06-28 Thread Alex Balashov

On 06/28/2016 11:06 AM, Owais Ahmad wrote:


Thats not the case Alex. But I am expecting a large number of UDP
messages arriving on the same port as my udp listening socket.
Just want to be sure there is no wasteful work done parsing such packets.


You can be reasonably sure that OpenSIPS "fingerprints" such packets 
quite efficiently and, if it doesn't type as a SIP packet, it won't be 
parsed.


For more details, see:

https://github.com/OpenSIPS/opensips/blob/master/parser/msg_parser.c#L543

As you can see, it parses the first line of the message first, and 
doesn't do any unnecessary work to parse the whole message if the first 
line doesn't suggest it's SIP.


I wouldn't worry about this "premature optimisation". :-)

--
Alex Balashov | Principal | Evariste Systems LLC
1447 Peachtree Street NE, Suite 700
Atlanta, GA 30309
United States

Tel: +1-800-250-5920 (toll-free) / +1-678-954-0671 (direct)
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/

___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Preventing invalid packet parsing

2016-06-28 Thread Owais Ahmad
Thats not the case Alex. But I am expecting a large number of UDP messages
arriving on the same port as my udp listening socket.
Just want to be sure there is no wasteful work done parsing such packets.

On Tue, Jun 28, 2016 at 8:04 PM, Alex Balashov 
wrote:

> Are you under the impression that these consume a significant amount of
> OpenSIPS resources? If so, how did you arrive at that conclusion?
>
> On 06/28/2016 11:02 AM, Owais Ahmad wrote:
>
>> Hello,
>>
>> I am getting UDP (non-SIP) packets on opensips listening port. How can I
>> drop those packets to ensure it only consumes the least opensips
>> resources.
>>
>> I do have mechanisms to prevent this on the firewall but just want to be
>> sure that if such a network packet does reach the server, opensips
>> doesn't end up parsing it assuming its SIP.
>>
>> I want to do this without using: sipmsg_validate
>> 
>> 
>>
>> Regards,
>> Owais
>>
>>
>> ___
>> Users mailing list
>> Users@lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>>
>
> --
> Alex Balashov | Principal | Evariste Systems LLC
> 1447 Peachtree Street NE, Suite 700
> Atlanta, GA 30309
> United States
>
> Tel: +1-800-250-5920 (toll-free) / +1-678-954-0671 (direct)
> Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
>
> ___
> Users mailing list
> Users@lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Preventing invalid packet parsing

2016-06-28 Thread Alex Balashov
Are you under the impression that these consume a significant amount of 
OpenSIPS resources? If so, how did you arrive at that conclusion?


On 06/28/2016 11:02 AM, Owais Ahmad wrote:

Hello,

I am getting UDP (non-SIP) packets on opensips listening port. How can I
drop those packets to ensure it only consumes the least opensips resources.

I do have mechanisms to prevent this on the firewall but just want to be
sure that if such a network packet does reach the server, opensips
doesn't end up parsing it assuming its SIP.

I want to do this without using: sipmsg_validate



Regards,
Owais


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users




--
Alex Balashov | Principal | Evariste Systems LLC
1447 Peachtree Street NE, Suite 700
Atlanta, GA 30309
United States

Tel: +1-800-250-5920 (toll-free) / +1-678-954-0671 (direct)
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/

___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


[OpenSIPS-Users] Preventing invalid packet parsing

2016-06-28 Thread Owais Ahmad
Hello,

I am getting UDP (non-SIP) packets on opensips listening port. How can I
drop those packets to ensure it only consumes the least opensips resources.

I do have mechanisms to prevent this on the firewall but just want to be
sure that if such a network packet does reach the server, opensips doesn't
end up parsing it assuming its SIP.

I want to do this without using: sipmsg_validate



Regards,
Owais
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users