- Format fixes

- Adding if(option_debug) in front of complicated debug messages...


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@27305 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.4
Olle Johansson 19 years ago
parent 43afee3a0c
commit ea510a4cf9

@ -338,12 +338,14 @@ static int stun_handle_packet(int s, struct sockaddr_in *src, unsigned char *dat
int resplen, respleft;
if (len < sizeof(struct stun_header)) {
if (option_debug)
ast_log(LOG_DEBUG, "Runt STUN packet (only %d, wanting at least %d)\n", len, sizeof(struct stun_header));
return -1;
}
if (stundebug)
ast_verbose("STUN Packet, msg %s (%04x), length: %d\n", stun_msg2str(ntohs(hdr->msgtype)), ntohs(hdr->msgtype), ntohs(hdr->msglen));
if (ntohs(hdr->msglen) > len - sizeof(struct stun_header)) {
if (option_debug)
ast_log(LOG_DEBUG, "Scrambled STUN packet length (got %d, expecting %d)\n", ntohs(hdr->msglen), len - sizeof(struct stun_header));
} else
len = ntohs(hdr->msglen);
@ -351,15 +353,18 @@ static int stun_handle_packet(int s, struct sockaddr_in *src, unsigned char *dat
memset(&st, 0, sizeof(st));
while(len) {
if (len < sizeof(struct stun_attr)) {
if (option_debug)
ast_log(LOG_DEBUG, "Runt Attribute (got %d, expecting %d)\n", len, sizeof(struct stun_attr));
break;
}
attr = (struct stun_attr *)data;
if (ntohs(attr->len) > len) {
if (option_debug)
ast_log(LOG_DEBUG, "Inconsistant Attribute (length %d exceeds remaining msg len %d)\n", ntohs(attr->len), len);
break;
}
if (stun_process_attr(&st, attr)) {
if (option_debug)
ast_log(LOG_DEBUG, "Failed to handle attribute %s (%04x)\n", stun_attr2str(ntohs(attr->attr)), ntohs(attr->attr));
break;
}

Loading…
Cancel
Save