Increase SKINNY_MAX_PACKET and add some logging.

Increase SKINNY_MAX_PACKET to 2000 bytes to handle some messages
in v17 that are greater than the old 1000 bytes. Also add some
useful logging regarding packet and session handling.

A device (with protocol v17) was sending a packet with length 
greater than 1000 which resulted in the TCP session being
destroyed and registration being retryed.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@340070 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Damien Wedhorn 2011-10-10 00:36:02 +00:00
parent 0ac40dc255
commit c5546e2bd7
1 changed files with 4 additions and 1 deletions

View File

@ -166,7 +166,7 @@ enum skinny_codecs {
#define DEFAULT_SKINNY_PORT 2000
#define DEFAULT_SKINNY_BACKLOG 2
#define SKINNY_MAX_PACKET 1000
#define SKINNY_MAX_PACKET 2000
#define DEFAULT_AUTH_TIMEOUT 30
#define DEFAULT_AUTH_LIMIT 50
@ -6862,6 +6862,7 @@ static int get_input(struct skinnysession *s)
return -1;
}
if (dlen+8 > sizeof(s->inbuf)) {
ast_log(LOG_WARNING, "Skinny packet too large (%d bytes), max length(%d bytes)\n", dlen+8, SKINNY_MAX_PACKET);
dlen = sizeof(s->inbuf) - 8;
}
*bufaddr = htolel(dlen);
@ -6915,6 +6916,7 @@ static void *skinny_session(void *data)
for (;;) {
res = get_input(s);
if (res < 0) {
ast_verb(3, "Ending Skinny session from %s (bad input)\n", ast_inet_ntoa(s->sin.sin_addr));
break;
}
@ -6922,6 +6924,7 @@ static void *skinny_session(void *data)
{
if (!(req = skinny_req_parse(s))) {
destroy_session(s);
ast_verb(3, "Ending Skinny session from %s (failed parse)\n", ast_inet_ntoa(s->sin.sin_addr));
return NULL;
}