Summary:ASTERISK-15588: [patch] res_pktccops.so doesn't export a symbol, chan_mgcp will not load or will malfunction depending on gcc version
Reporter:Nahuel Greco (nahuelgreco)Labels:
Date Opened:2010-02-05 18:56:14.000-0600Date Closed:2010-02-10 15:55:44.000-0600
Versions:Frequency of
Environment:Attachments:( 0) res_pktccops.exports
Description:res_pktccops.so is generated without exported symbols, because a res_pktccops.exports file is missing in the res/ directory.

This is fun, because if you try it in a modern platform, AST_OPTIONAL_API macro will do his magic and chan_mgcp.so will load with no complaints because the ast_pktccops_gate_alloc symbol is declared as an optional dependency. But then it will silenty fail when trying to open gates at the CMTS, because AST_OPTIONAL_API will provide ast_pktccops_gate_alloc as a an always-returning-NULL stub.

If you try it in an old platform, like RHEL 5.0 (gcc 4.1.1), chan_mgcp.so will not load, saying there is an undefined symbol ast_pktccops_gate_alloc... while res_pktccops.so is already loaded. That's because AST_OPTIONAL_API macro will do nothing special in presence of a gcc version that doesn't support weak symbols, so all symbols will be required.

Solution: Add the attached res_pktccops.exports file to the res/ directory.

This was tested with SVN trunk rev 245184.

RHEL 5.0 log (second case):

*CLI> module show like pkt
Module                         Description                              Use Count
res_pktccops.so                PktcCOPS manager for MGCP                0
1 modules loaded
*CLI> module load chan_mgcp.so
[2010-02-05 18:39:15.565] WARNING[2761]: loader.c:429 load_dynamic_module: Error loading module 'chan_mgcp.so': /usr/lib/asterisk/modules/chan_mgcp.so: undefined symbol: ast_pktccops_gate_alloc
[2010-02-05 18:39:15.565] WARNING[2761]: loader.c:820 load_resource: Module 'chan_mgcp.so' could not be loaded.
Unable to load module chan_mgcp.so
Command 'module load chan_mgcp.so ' failed.
Comments:By: Digium Subversion (svnbot) 2010-02-10 15:55:43.000-0600

Repository: asterisk
Revision: 246208

A   trunk/res/res_pktccops.exports

r246208 | tilghman | 2010-02-10 15:55:43 -0600 (Wed, 10 Feb 2010) | 7 lines

res_pktccops needs to be able to export a symbol for chan_mgcp

(closes issue ASTERISK-15588)
Reported by: nahuelgreco
      res_pktccops.exports uploaded by nahuelgreco (license 162)