[Asterisk-code-review] main/udptl.c: correctly handle udptl sequence wrap around (...asterisk[13])
Torrey Searle
asteriskteam at digium.com
Wed Jul 17 07:37:52 CDT 2019
Torrey Searle has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/11575
Change subject: main/udptl.c: correctly handle udptl sequence wrap around
......................................................................
main/udptl.c: correctly handle udptl sequence wrap around
incorrect handling of UDPTL squence number wrap arounds causes
loss of packets every time the wrap arround occurs
ASTERISK-28483 #close
Change-Id: I33caeb2bf13c574a1ebb81714b58907091d64234
---
M main/udptl.c
1 file changed, 9 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/75/11575/1
diff --git a/main/udptl.c b/main/udptl.c
index 59fccf4..2572f5c 100644
--- a/main/udptl.c
+++ b/main/udptl.c
@@ -406,6 +406,15 @@
seq_no = (buf[0] << 8) | buf[1];
ptr += 2;
+ /* compensate for sequence number wrap arounds */
+ if (seq_no < 0x000F && s->rx_seq_no > 0xFFF0) {
+ /* received seq_no has wrapped adjust it */
+ seq_no += 0x10000;
+ } else {
+ /* otherwise make sure expected rx_seq_no is properly wrapped */
+ s->rx_seq_no &= 0xFFFF;
+ }
+
/* Break out the primary packet */
if ((stat1 = decode_open_type(buf, len, &ptr, &ifp, &ifp_len)) != 0)
return -1;
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/11575
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I33caeb2bf13c574a1ebb81714b58907091d64234
Gerrit-Change-Number: 11575
Gerrit-PatchSet: 1
Gerrit-Owner: Torrey Searle <tsearle at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190717/ab0c15e7/attachment.html>
More information about the asterisk-code-review
mailing list