[OpenSIPS-Users] Preventing invalid packet parsing

Bogdan-Andrei Iancu bogdan at opensips.org
Tue Jun 28 17:33:02 CEST 2016


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 
> <abalashov at evaristesys.com <mailto:abalashov at evaristesys.com>> 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
>         <http://www.opensips.org/html/docs/modules/2.1.x/sipmsgops.html#id294336>
>         <http://www.opensips.org/html/docs/modules/2.1.x/sipmsgops.html#id294336>
>
>         Regards,
>         Owais
>
>
>         _______________________________________________
>         Users mailing list
>         Users at lists.opensips.org <mailto:Users at 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 <tel:%2B1-800-250-5920> (toll-free) /
>     +1-678-954-0671 <tel:%2B1-678-954-0671> (direct)
>     Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
>
>     _______________________________________________
>     Users mailing list
>     Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>     http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20160628/cc6a5b2a/attachment-0001.htm>


More information about the Users mailing list