[asterisk-dev] [Code Review] 3885: chan_iax2: Fix a crash caused by trying to allow all codecs on a chan_iax2 peer

Mark Michelson reviewboard at asterisk.org
Fri Aug 1 15:56:10 CDT 2014


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

Ship it!


- Mark Michelson


On July 31, 2014, 9:40 p.m., Jonathan Rose wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/3885/
> -----------------------------------------------------------
> 
> (Updated July 31, 2014, 9:40 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Bugs: ASTERISK-24107
>     https://issues.asterisk.org/jira/browse/ASTERISK-24107
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> When using an IAX2 peer configured with:
> allow=all
> 
> Asterisk will segfault when building the peer while loading chan_iax2.so
> 
> This is caused by ast_format_cmp trying to compare two ast_format structs using the codec opus format interface defined in res_format_attr_opus. This format interface doesn't define a format comparison function, so when we try to use this undefined function, boom.
> 
> The fix for this was to treat an interface without a comparison function in the same manner as we treat comparison with formats that don't have interfaces.
> 
> 
> Diffs
> -----
> 
>   /trunk/main/format.c 419870 
> 
> Diff: https://reviewboard.asterisk.org/r/3885/diff/
> 
> 
> Testing
> -------
> 
> It doesn't crash anymore. That's a start.  I also checked the output for the CLI command 'iax2 show peer' for the peer I was using to define all the codecs and that appeared to work alright. Also made a call with just opus and ulaw set as codecs (opus should have been the preferred).  Opus ended up not being included in the list of preferred codecs (although output for just Codecs still includes it for some reason) and when making a call the endpoint would choose ulaw.
> 
> *CLI> iax2 show peer lappy
> 
> 
>   * Name       : lappy
>   Description  : 
>   Secret       : <Set>
>   Context      : default
>   Parking lot  : 
>   Mailbox      : 
>   Dynamic      : Yes
>   Callnum limit: 0
>   Calltoken req: No
>   Trunk        : No
>   Encryption   : No
>   Callerid     : "" <>
>   Expire       : 4
>   ACL          : No
>   Addr->IP     : 10.24.16.82 Port 4569
>   Defaddr->IP  : (null) Port (null)
>   Username     : lappy
>   Codecs       : (ulaw|opus)
>   Codec Order  : (ulaw)
>   Status       : OK (38 ms)
>   Qualify      : every 60000ms when OK, every 10000ms when UNREACHABLE (sample smoothing Off)
> 
> *CLI> 
> *CLI> 
> *CLI> 
> *CLI>     -- Accepting AUTHENTICATED call from 10.24.16.82:4569:
>     --        > requested format = ulaw,
>     --        > requested prefs = (),
>     --        > actual format = ulaw,
>     --        > host prefs = (ulaw),
>     --        > priority = mine
> 
> 
> It gets slightly weirder right now when more stuff is specified after opus...
> 
> [deskbox]
> disallow=all
> allow=opus
> allow=ulaw
> allow=alaw
> 
> results:
> 
> *CLI> iax2 show peer deskbox 
> 
> 
>   * Name       : deskbox
>   Description  : 
>   Secret       : <Set>
>   Context      : default
>   Parking lot  : 
>   Mailbox      : 
>   Dynamic      : Yes
>   Callnum limit: 0
>   Calltoken req: No
>   Trunk        : No
>   Encryption   : No
>   Callerid     : "" <>
>   Expire       : -1
>   ACL          : No
>   Addr->IP     : (null) Port (null)
>   Defaddr->IP  : (null) Port (null)
>   Username     : deskbox
>   Codecs       : (ulaw|alaw)
>   Codec Order  : (ulaw|alaw)
>   Status       : UNKNOWN
>   Qualify      : every 60000ms when OK, every 10000ms when UNREACHABLE (sample smoothing Off)
> 
> 
> This is due to a quirk with how we are currently building the codec preferences list and may get resolved by some stuff rmudgett is working on, so this patch just focuses on resolving the crash.
> 
> 
> Thanks,
> 
> Jonathan Rose
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140801/92714847/attachment.html>


More information about the asterisk-dev mailing list