[Home]

Summary:ASTERISK-24515: Unconditional use of fopencookie() / funopen() is non-portable
Reporter:Timo Teräs (fabled)Labels:
Date Opened:2014-11-11 02:39:18.000-0600Date Closed:2016-11-17 11:07:35.000-0600
Priority:MajorRegression?Yes
Status:Closed/CompleteComponents:Core/Portability
Versions:12.7.0 13.0.0 Frequency of
Occurrence
Related
Issues:
is related toASTERISK-24517 TLS support for Solaris, Ming and non-glibc Linux systems
Environment:Attachments:
Description:The fix for AST-2014-007 made Asterisk 13 and newer use non-portable.

The code now relies on fopencookie() (GNU extension) or funopen() (BSD / OSX extension) for any kind of TCP-socket. Previously fdopen() was used which is standard compliant function. What is worse, the code compiles, but the functionality is crippled.

This means the TCP-socket core is now unusable for multiple platforms e.g. Solaris, Cygwin, and Linux systems not using glibc (e.g. Alpine Linux using musl as C-library).
Comments:By: Timo Teräs (fabled) 2014-11-12 03:01:46.396-0600

Related to ASTERISK-15490. But this is about the fact that ALL TCP-connections are now UNUSABLE with Solaris, Cygwin, and non-glibc Linux systems. So this is a major regression in portability. It seems Asterisk 12-branch is also affected.

By: Matt Jordan (mjordan) 2014-11-12 11:43:52.558-0600

While we strive for portability, we strive for correctness - and a lack of gaping security breaches - more. Generally, Asterisk is geared towards Linux. We don't go out of our way to break other OS's, but frankly, it's rarely on the radar when we make changes. Given the resources available, I don't see that changing any time soon.

That being said, we'd certainly like to support other systems where possible. If you'd like to provide a patch that fixes the compatibility issues, that would be hugely appreciated - however, I don't expect a lot of focus to be given to this issue without a patch.

By: Rusty Newton (rnewton) 2014-11-13 15:59:30.090-0600

A link to the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process] for reference.

By: Timo Teräs (fabled) 2014-11-15 02:51:45.137-0600

Curiously the fix available as patch in the AST advisory is portable, and different from what was committed in SVN. But obviously this will be fixed as side effect if ASTERISK-24517 is fixed properly.

By: Timo Teräs (fabled) 2014-12-05 05:43:28.907-0600

This is something I am willing to work on a bit later, when I get my current other things finished.

By: Seán C. McCord (ulexus@gmail.com) 2016-02-10 13:17:47.969-0600

Note for relevance:  this bug is blocking all TCP-transported services of Asterisk (read AMI, ARI, SIP/TCP) on Alpine Linux, which is rapidly becoming the base platform of choice for Docker images.  

By: Timo Teräs (fabled) 2016-02-10 13:38:31.134-0600

ASTERISK-24517 has a (probably now slightly outdated) patch attached to it. Unfortunately there's been no feedback on it.

By: Friendly Automation (friendly-automation) 2016-11-01 09:05:45.905-0500

Change 2932 had a related patch set uploaded by Timo Teräs:
Implement internal abstraction for iostreams

[https://gerrit.asterisk.org/2932|https://gerrit.asterisk.org/2932]

By: Friendly Automation (friendly-automation) 2016-11-17 11:07:36.655-0600

Change 2932 merged by Joshua Colp:
Implement internal abstraction for iostreams

[https://gerrit.asterisk.org/2932|https://gerrit.asterisk.org/2932]