[OpenSIPS-Users] Preventing invalid packet parsing
Alex Balashov
abalashov at evaristesys.com
Tue Jun 28 17:24:58 CEST 2016
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/
More information about the Users
mailing list