[SR-Users] random incorrect method parsing
Daniel-Constantin Mierla
miconda at gmail.com
Thu Dec 10 09:11:12 CET 2015
Hello,
update on this -- I pushed last evening to master a slightly different
patch, to skip other white space characters before the method is started
to be parsed.
Not having much time, I didn't dig further in the code, but the position
of the patch suggests that these leading whitespaces are still kept in
the message buffer, which may result in sending them out as well, unless
before sending, its another trim of whitespaces.
My opinion is that the tcp read code should trim these whitespaces and
provide msg buffer with the start of the method for sip requests. So I
will analyze more and then see if a different fix would be better,
before considering to backport to stable branches.
Cheers,
Daniel
On 09/12/15 16:41, Daniel-Constantin Mierla wrote:
> Hello,
>
> good it was caught. I think it is good/safe to skip the '\0' together
> with the white spaces at the beginning for the request. I will analyze
> the impact and push the patch for it.
>
> Cheers,
> Daniel
>
> On 09/12/15 12:05, Vasiliy Ganchev wrote:
>> Hi Daniel!
>>
>> Thank you for the suggestion, after the deep investigation, looks like the
>> root of the problem found:
>>
>> when device send TCP ACK (before INVITE), in this packet is incapsulated
>> "VSS-Monitoring ethernet trailer, Source Port: 0", example in file in
>> attachment.
>> Looks like kamailio parse it, and add the received /0 to the beginning of
>> following SIP request (INVITE), as a result - incorrect Method parsing and
>> 400 error.
>>
>> The way to solve current problem, is to modify the check below:
>> --- parser/msg_parser.c (revision xxxxx)
>> +++ parser/msg_parser.c (working copy)
>> @@ -607,7 +607,7 @@
>> hdr_flags_t flags;
>>
>> /* eat crlf from the beginning */
>> - for (tmp=buf; (*tmp=='\n' || *tmp=='\r')&&
>> + for (tmp=buf; (*tmp=='\n' || *tmp=='\r' || *tmp=='\0')&&
>> tmp-buf < len ; tmp++);
>>
>> Do we need such change in kamailio?
>>
>> Cheers! issued_packet_with_extra_0.pcap
>> <http://sip-router.1086192.n5.nabble.com/file/n143771/issued_packet_with_extra_0.pcap>
>>
>>
>>
>> --
>> View this message in context: http://sip-router.1086192.n5.nabble.com/random-incorrect-method-parsing-tp143749p143771.html
>> Sent from the Users mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>> sr-users at lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Book: SIP Routing With Kamailio - http://www.asipto.com
http://miconda.eu
More information about the sr-users
mailing list