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

Jonathan Rose reviewboard at asterisk.org
Tue Aug 5 08:44:06 CDT 2014


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

(Updated Aug. 5, 2014, 8:44 a.m.)


Review request for Asterisk Developers.


Changes
-------

This is actually a trunk fix.  Not sure why I wrote it down as 12.


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/20140805/75a2fe83/attachment.html>


More information about the asterisk-dev mailing list