[Home]

Summary:ASTERISK-15383: [patch] sin_family not set to AF_INET when running trunk on Solaris nevada
Reporter:Chris Walton (crjw)Labels:
Date Opened:2010-01-05 00:19:45.000-0600Date Closed:2010-01-18 16:05:45.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/RTP
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) rtp_sin_family.patch
Description:Dialing from any phone fails because sin_family is set to 0 instead of 2 for the RTP traffic.
Asterisk logs the following error:
"res_rtp_asterisk.c:437 ast_rtp_new: Oh dear... we couldn't allocate a port for RTP instance '827de88'"


****** ADDITIONAL INFORMATION ******

Error is repeatable on Solaris nevada builds 115 and 129.
Dtrace shows that the "bind" system call is being called with sin_family set to zero; it should be equal to AF_INET (AF_INET is 2).
The "bind" system call returns with "ErrASTERISK-120 EAFNOSUPPORT".

Line 288 of main/rtp_engine.c reads:
struct sockaddr_in address = { 0, };
There is nothing in place to set address.sin_family... so it seems to default to zero.
If add the following line right after line 288 in main/rtp_engine.c:
address.sin_family=AF_INET;
the problem goes away.
Comments:By: snuffy (snuffy) 2010-01-06 04:49:30.000-0600

After looking through the code there are quite a few places this occurs.

Noting that generally ast_rtp_instance_get_remote_address() is called most times and checks that its not AF_NET sin_family.

Maybe someone else could comment.

By: Chris Walton (crjw) 2010-01-08 11:44:38.000-0600

"Target Version" field for this bug was updated to 1.4.30 by lmadsen today.
I find this odd since the problem was reported against the trunk.

I never experienced the problem in 1.4 or 1.6 versions.
I believe that the problem was introduced into the trunk on April 2/2009 along with the new RTP engine code.

By: Chris Walton (crjw) 2010-01-10 21:26:29.000-0600

I have uploaded a patch that adds one line to main/rtp_engine.c

If somebody wishes, they can create a more extensive patch, but in my case, this one-line fix was enough to make RTP work correctly.

Without the patch, Asterisk runs without crashing, but it is impossible to make phone calls.

I only tested the patch on Solaris nevada build 129.
I did not test on Linux (which does not need the patch), but I can not imagine that this patch could possibly break anything.

By: snuffy (snuffy) 2010-01-11 02:37:38.000-0600

Hmm.. by the looks of the lines around your patch.
It seems reasonable to have it setting AF_NET.

By: Digium Subversion (svnbot) 2010-01-18 16:03:50.000-0600

Repository: asterisk
Revision: 241098

U   trunk/main/rtp_engine.c

------------------------------------------------------------------------
r241098 | qwell | 2010-01-18 16:03:49 -0600 (Mon, 18 Jan 2010) | 8 lines

Fix an RTP instance allocation failure on Solaris.

(closes issue ASTERISK-15383)
Reported by: crjw
Patches:
     rtp_sin_family.patch uploaded by crjw (license 963)
Tested by: crjw, qwell

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=241098

By: Digium Subversion (svnbot) 2010-01-18 16:05:37.000-0600

Repository: asterisk
Revision: 241099

_U  branches/1.6.0/

------------------------------------------------------------------------
r241099 | qwell | 2010-01-18 16:05:36 -0600 (Mon, 18 Jan 2010) | 14 lines

Blocked revisions 241098 via svnmerge

........
 r241098 | qwell | 2010-01-18 16:03:49 -0600 (Mon, 18 Jan 2010) | 8 lines
 
 Fix an RTP instance allocation failure on Solaris.
 
 (closes issue ASTERISK-15383)
 Reported by: crjw
 Patches:
       rtp_sin_family.patch uploaded by crjw (license 963)
 Tested by: crjw, qwell
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=241099

By: Digium Subversion (svnbot) 2010-01-18 16:05:41.000-0600

Repository: asterisk
Revision: 241100

_U  branches/1.6.1/

------------------------------------------------------------------------
r241100 | qwell | 2010-01-18 16:05:40 -0600 (Mon, 18 Jan 2010) | 14 lines

Blocked revisions 241098 via svnmerge

........
 r241098 | qwell | 2010-01-18 16:03:49 -0600 (Mon, 18 Jan 2010) | 8 lines
 
 Fix an RTP instance allocation failure on Solaris.
 
 (closes issue ASTERISK-15383)
 Reported by: crjw
 Patches:
       rtp_sin_family.patch uploaded by crjw (license 963)
 Tested by: crjw, qwell
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=241100

By: Digium Subversion (svnbot) 2010-01-18 16:05:44.000-0600

Repository: asterisk
Revision: 241101

_U  branches/1.6.2/

------------------------------------------------------------------------
r241101 | qwell | 2010-01-18 16:05:44 -0600 (Mon, 18 Jan 2010) | 14 lines

Blocked revisions 241098 via svnmerge

........
 r241098 | qwell | 2010-01-18 16:03:49 -0600 (Mon, 18 Jan 2010) | 8 lines
 
 Fix an RTP instance allocation failure on Solaris.
 
 (closes issue ASTERISK-15383)
 Reported by: crjw
 Patches:
       rtp_sin_family.patch uploaded by crjw (license 963)
 Tested by: crjw, qwell
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=241101