From: Russell Bryant Date: Thu, 19 Jul 2007 15:49:42 +0000 (+0000) Subject: When processing full frames, take sequence number wraparound into account when X-Git-Tag: 1.2.26.1~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9df29ba46f808417e310f73249a9a79c8a7268ba;p=thirdparty%2Fasterisk.git When processing full frames, take sequence number wraparound into account when deciding whether or not we need to request retransmissions by sending a VNAK. This code could cause VNAKs to be sent erroneously in some cases, and to not be sent in other cases when it should have been. (closes issue #10237, reported and patched by mihai) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@75927 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index ad120dbdcf..3351d81f9f 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -6710,7 +6710,9 @@ static int socket_read(int *id, int fd, short events, void *cbdata) if (option_debug) ast_log(LOG_DEBUG, "Packet arrived out of order (expecting %d, got %d) (frametype = %d, subclass = %d)\n", iaxs[fr->callno]->iseqno, fr->oseqno, f.frametype, f.subclass); - if (iaxs[fr->callno]->iseqno > fr->oseqno) { + /* Check to see if we need to request retransmission, + * and take sequence number wraparound into account */ + if ((unsigned char) (iaxs[fr->callno]->iseqno - fr->oseqno) < 128) { /* If we've already seen it, ack it XXX There's a border condition here XXX */ if ((f.frametype != AST_FRAME_IAX) || ((f.subclass != IAX_COMMAND_ACK) && (f.subclass != IAX_COMMAND_INVAL))) {