[pjsip] Error sending msg > PJSIP_MAX_PKT_LEN inpjsip_msg_print()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Benny,

I think I have found the bug.

tdata->msg->body->print_body = generic_print_body(pjsip_msg_body *, char *, unsigned int)

In generic_print_body():

Size = 442, body->len = 485 --> Because size < body->len the function doesn't copy the body and returns 0 which is the body length
in pjsip_msg_print(). I think generic_print_body() in this case must return -1, so pjsip_msg_print() returns -1 and mod_on_tx_msg()
then returns PJSIP_EMSGTOOLONG.

I have tested it changing the return value to -1 in generic_print_body() and it seems to work. When receiving too big msg I get an
pj log " tsx009F3A2C Failed to send Request msg INVITE/cseq=2 (tdta009F19A8)! err=171023 (Message too long (PJSIP_EMSGTOOLONG))" and
500 Internal Server Error is sended back. After increasing PJSIP_MAX_PKT_LEN to 3000 it works fine.

Can I get problems (maybe with the stack) if PJSIP_MAX_PKT_LEN and PJ_LOG_MAX_SIZE are 3000 ? Is it better if
PJ_LOG_USE_STACK_BUFFER is 0 ? If so, can this decrease the performance ?
 
Best regards,
Helmut



-----Urspr?ngliche Nachricht-----
Von: pjsip-bounces at lists.pjsip.org [mailto:pjsip-bounces at lists.pjsip.org] Im Auftrag von Benny Prijono
Gesendet: Mittwoch, 10. Oktober 2007 19:03
An: pjsip embedded/DSP SIP discussion
Betreff: Re: [pjsip] Error sending msg > PJSIP_MAX_PKT_LEN inpjsip_msg_print()

Helmut Wolf wrote:
> Hi Benny,
> 
> I am using stateful_proxy.c
> 
> Test case: I have received an INVITE msg which has to be forwarded. After attaching some SIP headers it has a length of 2053
Bytes,
> which is bigger than the default PJSIP_MAX_PKT_LEN of 2000. The result is that the msg is forwarded but there is no SDP Body and
the
> content-length is 0.
> 
> I suppose the error is sip_transport.c -> mod_on_tx_msg() -> pjsip_msg_print() where the msg is printed to tdata->buf. The
function
> returns a value > 0 but I think it must return a value < 0 so mod_on_tx_msg() returns with PJSIP_EMSGTOOLONG...

That is the expected behavior indeed.

It's just that it's rather difficult to pinpoint where the fault 
was. For the most part, pjsip_msg_print() doesn't really print the 
message by itself, but rather calls various xx_print() callbacks 
that are registered with the SIP headers and body. So it could be 
that one of these callbacks failed to check the remaining length of 
the print buffer or it didn't return -1 to signal pjsip_msg_print() 
that the print buffer is not long enough.

What kind of message body it is? And what callback was put in 
pjsip_msg_body structure?

And same question for the SIP headers. Can you list the header names 
used in the message?

regards,
  -benny

> I have setted PJSIP_MAX_PKT_LEN to 3000 and then it works fine.
> 
> Best regards,
> Helmut



_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip at lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org




[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux