[Home]

Summary:ASTERISK-27406: Infinite loop when out of ports and rtpstart value is odd
Reporter:Thomas Guebels (tguescaux)Labels:patch
Date Opened:2017-11-08 10:34:10.000-0600Date Closed:2021-12-06 10:01:37.000-0600
Priority:TrivialRegression?No
Status:Closed/CompleteComponents:Resources/res_rtp_asterisk
Versions:13.18.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Attachments:( 0) round_up_to_even.diff
Description:When the rtpstart value configured in rtp.conf parity is odd and all RTP ports are already used, the next call will start an infinite loop.

ast_rtp_new walks through the RTP port range configured until it finds a free one. It starts at a random position, wraps around at the end of the range and return an error if it comes back to the starting position.

Unfortunately, this code assumes an even value was set in rtpstart since we never go back to the starting position otherwise.

Either a correct value for rtpstart should be enforced when parsing the configuration or the port lookup should not assume anything and never fail to break the loop.
Comments:By: Asterisk Team (asteriskteam) 2017-11-08 10:34:10.841-0600

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

By: Thomas Guebels (tguescaux) 2017-11-08 10:38:23.622-0600

Proposed patch: Rounding up the starting position to even, instead of rounding down

This removes the discrepancy between the rounding made before the loop and inside the loop, ensuring the break condition will always match.

It has the added benefit of not starting outside of the range (1 before rtpstart) in case we choose to round down in both places.

By: Friendly Automation (friendly-automation) 2021-12-06 10:01:38.240-0600

Change 16637 merged by Friendly Automation:
res_rtp_asterisk: Addressing possible rtp range issues

[https://gerrit.asterisk.org/c/asterisk/+/16637|https://gerrit.asterisk.org/c/asterisk/+/16637]

By: Friendly Automation (friendly-automation) 2021-12-06 10:02:45.411-0600

Change 17613 merged by Friendly Automation:
res_rtp_asterisk: Addressing possible rtp range issues

[https://gerrit.asterisk.org/c/asterisk/+/17613|https://gerrit.asterisk.org/c/asterisk/+/17613]

By: Friendly Automation (friendly-automation) 2021-12-06 10:04:49.612-0600

Change 17614 merged by Friendly Automation:
res_rtp_asterisk: Addressing possible rtp range issues

[https://gerrit.asterisk.org/c/asterisk/+/17614|https://gerrit.asterisk.org/c/asterisk/+/17614]

By: Friendly Automation (friendly-automation) 2021-12-06 10:05:10.361-0600

Change 17615 merged by Friendly Automation:
res_rtp_asterisk: Addressing possible rtp range issues

[https://gerrit.asterisk.org/c/asterisk/+/17615|https://gerrit.asterisk.org/c/asterisk/+/17615]