[asterisk-dev] [Code Review] Resolve Sequence Number Rollover causing codec increase in res_rtp_multicast

jrose reviewboard at asterisk.org
Thu Oct 27 11:21:57 CDT 2011


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1542/
-----------------------------------------------------------

(Updated Oct. 27, 2011, 11:21 a.m.)


Review request for Asterisk Developers.


Changes
-------

Rmudgett was wary of the use of uint16_t alone, so he suggested I do the bitwise and operation as well. He explained that if it did in fact do nothing that the compiler will usually be savvy of that and optimize it out.

I also retested the patch with just the uint16_t change and just the bitwise change as well as both together to make sure they worked as expected.


Summary
-------

Basically what was happening was the sequence number would go above 65535, and rather than rolling back to zero, the extra bits would overflow into the codec bits of the RTP packet.  Because of this, if the sequence number goes above 65535, it'll make the codec value change and this can make calls fail.

This patch simply checks the value of the sequence number each time it is incremented and sets it back to 0 if it's above 65535.  Shouldn't cause any problems.


This addresses bug ASTERISK-18291.
    https://issues.asterisk.org/jira/browse/ASTERISK-18291


Diffs (updated)
-----

  /branches/1.8/res/res_rtp_multicast.c 341429 

Diff: https://reviewboard.asterisk.org/r/1542/diff


Testing
-------

I checked the unpatched version with wireshark to make sure the codec shift was in fact happening and it was.  I checked it again after patching and made sure the problem went away and it did.  I also checked to see whether the values stayed as expected if I forcibly changed the codec value to something other than 0, and in all cases it behaved as expected.


Thanks,

jrose

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20111027/8a2a829f/attachment-0001.htm>


More information about the asterisk-dev mailing list