[prev in list] [next in list] [prev in thread] [next in thread]
List: asterisk-dev
Subject: Re: [asterisk-dev] [Code Review]: Correct the number of available call numbers in IAX2
From: "Sean Bright" <reviewboard () asterisk ! org>
Date: 2013-01-28 19:50:20
Message-ID: 20130128195020.768.43204 () hotblack ! digium ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
> On Jan. 28, 2013, 12:39 p.m., rmudgett wrote:
> > Systems compiled with LOW_MEMORY have similar problems with the 2048 ca=
llno value. The way TRUNK_CALL_START is used in a bit test does not work o=
n the 2048 callno value because the tested bit is not set.
> > =
> > The only reason I can find that IAX_MAX_CALLS needs to be a power of 2 =
is when defining TRUNK_CALL_START and the use of it in a bit test in make_t=
runk(). Changing make_trunk() to use a compare operator instead of a bit t=
est should remove all requirements that IAX_MAX_CALLS be a power of two. I=
t should be recommended that IAX_MAX_CALLS be a power of two for ease of di=
stinguishing normal/trunk calls in IAX traces but not required.
> > =
> > TRUNK_CALL_START should also have insulating parentheses around the def=
inition to avoid unexpected operator precedence issues.
> >
> =
> Sean Bright wrote:
> > Systems compiled with LOW_MEMORY have similar problems with the 204=
8 callno value. The way TRUNK_CALL_START
> > is used in a bit test does not work on the 2048 callno value becaus=
e the tested bit is not set.
> =
> If LOW_MEMORY is defined, IAX_MAX_CALLS will be 2048, TRUNK_CALL_STAR=
T will be 1024 (0x400). So other than the parentheses, is any other change=
needed?
> =
> rmudgett wrote:
> 2048 is 0x800. 0x800 & 0x400 is 0. Callno 2048 is considered a trun=
k callno by the other code using TRUNK_CALL_START. The bitwise comparison =
is therefore wrong in make_trunk().
> =
> Fixing the bitwise test in make_trunk() also means the comment at the=
IAX_MAX_CALLS definition needs to be changed to recommend that the value b=
e a power of 2 but not require it.
> =
> This patch is removing 2048 as a valid callno when LOW_MEMORY is defi=
ned. This is a behavior change from previous versions that should be menti=
oned in UPGRADE.txt. Of course if the LOW_MEMORY value is changed to 2049 =
then there is no behavior change because callno 2048 remains available. Th=
e 2048 callno will even be functional.
Got it.
- Sean
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2293/#review7754
-----------------------------------------------------------
On Jan. 28, 2013, 1:01 p.m., Sean Bright wrote:
> =
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2293/
> -----------------------------------------------------------
> =
> (Updated Jan. 28, 2013, 1:01 p.m.)
> =
> =
> Review request for Asterisk Developers.
> =
> =
> Summary
> -------
> =
> While populating the list of available call numbers in IAX2 when LOW_MEMO=
RY is not defined, we use every number between 2 and 32768 (inclusive). 32=
768 is a 16 bit number (a 1 followed by 15 0s). According to the IAX2 RFC,=
call numbers are 15 bit values, making 32768 invalid.
> =
> This patch reduces the number of allocated call numbers by 1 so that the =
are all 15 bits.
> =
> I intend to commit this change to Asterisk versions 1.8, 11, and trunk.
> =
> I have another patch to replace the ao2_container usage for call number s=
election almost ready for RB as well.
> =
> =
> Diffs
> -----
> =
> /trunk/channels/chan_iax2.c 380249 =
> =
> Diff: https://reviewboard.asterisk.org/r/2293/diff
> =
> =
> Testing
> -------
> =
> Ran thousands of test calls (both trunked and non-trunked) between 3 Aste=
risk servers.
> =
> =
> Thanks,
> =
> Sean
> =
>
[Attachment #5 (text/html)]
<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;"> <tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://reviewboard.asterisk.org/r/2293/">https://reviewboard.asterisk.org/r/2293/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <p style="margin-top: 0;">On January 28th, 2013, 12:39 p.m., <b>rmudgett</b> \
wrote:</p> <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; \
padding-left: 10px;"> <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Systems \
compiled with LOW_MEMORY have similar problems with the 2048 callno value. The way \
TRUNK_CALL_START is used in a bit test does not work on the 2048 callno value because \
the tested bit is not set.
The only reason I can find that IAX_MAX_CALLS needs to be a power of 2 is when \
defining TRUNK_CALL_START and the use of it in a bit test in make_trunk(). Changing \
make_trunk() to use a compare operator instead of a bit test should remove all \
requirements that IAX_MAX_CALLS be a power of two. It should be recommended that \
IAX_MAX_CALLS be a power of two for ease of distinguishing normal/trunk calls in IAX \
traces but not required.
TRUNK_CALL_START should also have insulating parentheses around the definition to \
avoid unexpected operator precedence issues. </pre>
</blockquote>
<p>On January 28th, 2013, 12:53 p.m., <b>Sean Bright</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">> Systems compiled \
with LOW_MEMORY have similar problems with the 2048 callno value. The way \
TRUNK_CALL_START > is used in a bit test does not work on the 2048 callno value \
because the tested bit is not set.
If LOW_MEMORY is defined, IAX_MAX_CALLS will be 2048, TRUNK_CALL_START will be 1024 \
(0x400). So other than the parentheses, is any other change needed?</pre> \
</blockquote>
<p>On January 28th, 2013, 1:35 p.m., <b>rmudgett</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">2048 is 0x800. 0x800 \
& 0x400 is 0. Callno 2048 is considered a trunk callno by the other code using \
TRUNK_CALL_START. The bitwise comparison is therefore wrong in make_trunk().
Fixing the bitwise test in make_trunk() also means the comment at the IAX_MAX_CALLS \
definition needs to be changed to recommend that the value be a power of 2 but not \
require it.
This patch is removing 2048 as a valid callno when LOW_MEMORY is defined. This is a \
behavior change from previous versions that should be mentioned in UPGRADE.txt. Of \
course if the LOW_MEMORY value is changed to 2049 then there is no behavior change \
because callno 2048 remains available. The 2048 callno will even be \
functional.</pre> </blockquote>
</blockquote>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Got it.</pre> <br />
<p>- Sean</p>
<br />
<p>On January 28th, 2013, 1:01 p.m., Sean Bright wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('https://reviewboard.asterisk.org/media/rb/images/review_request_box_top_bg.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;"> <tr>
<td>
<div>Review request for Asterisk Developers.</div>
<div>By Sean Bright.</div>
<p style="color: grey;"><i>Updated Jan. 28, 2013, 1:01 p.m.</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">While populating the list of available call numbers in IAX2 when \
LOW_MEMORY is not defined, we use every number between 2 and 32768 (inclusive). \
32768 is a 16 bit number (a 1 followed by 15 0s). According to the IAX2 RFC, call \
numbers are 15 bit values, making 32768 invalid.
This patch reduces the number of allocated call numbers by 1 so that the are all 15 \
bits.
I intend to commit this change to Asterisk versions 1.8, 11, and trunk.
I have another patch to replace the ao2_container usage for call number selection \
almost ready for RB as well.</pre> </td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Ran thousands of test calls (both trunked and non-trunked) between 3 \
Asterisk servers.</pre> </td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/trunk/channels/chan_iax2.c <span style="color: grey">(380249)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/2293/diff/" style="margin-left: \
3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic