[asterisk-commits] coreyfarrell: trunk r406936 - in /trunk: ./ main/udptl.c res/res_rtp_asterisk.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 30 14:36:29 CST 2014


Author: coreyfarrell
Date: Thu Jan 30 14:36:21 2014
New Revision: 406936

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=406936
Log:
res_rtp_asterisk & udptl: fix port selection to work with SELinux restrictions

ast_bind to a port reserved for another program by SELinux causes
errno == EACCES.  This caused random failures when binding rtp or
udptl sockets.  Treat EACCES as a non-fatal error, try next port.

(closes issue ASTERISK-23134)
Reported by: Corey Farrell
........

Merged revisions 406933 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 406934 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 406935 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/main/udptl.c
    trunk/res/res_rtp_asterisk.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.

Modified: trunk/main/udptl.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/udptl.c?view=diff&rev=406936&r1=406935&r2=406936
==============================================================================
--- trunk/main/udptl.c (original)
+++ trunk/main/udptl.c Thu Jan 30 14:36:21 2014
@@ -1051,7 +1051,7 @@
 		if (ast_bind(udptl->fd, &udptl->us) == 0) {
 			break;
 		}
-		if (errno != EADDRINUSE) {
+		if (errno != EADDRINUSE && errno != EACCES) {
 			ast_log(LOG_WARNING, "Unexpected bind error: %s\n", strerror(errno));
 			close(udptl->fd);
 			ast_free(udptl);

Modified: trunk/res/res_rtp_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_rtp_asterisk.c?view=diff&rev=406936&r1=406935&r2=406936
==============================================================================
--- trunk/res/res_rtp_asterisk.c (original)
+++ trunk/res/res_rtp_asterisk.c Thu Jan 30 14:36:21 2014
@@ -1822,7 +1822,7 @@
 		}
 
 		/* See if we ran out of ports or if the bind actually failed because of something other than the address being in use */
-		if (x == startplace || errno != EADDRINUSE) {
+		if (x == startplace || (errno != EADDRINUSE && errno != EACCES)) {
 			ast_log(LOG_ERROR, "Oh dear... we couldn't allocate a port for RTP instance '%p'\n", instance);
 			close(rtp->s);
 			ast_free(rtp);




More information about the asterisk-commits mailing list