[asterisk-commits] moy: branch moy/mfcr2-1.2 r152131 - in /team/moy/mfcr2-1.2: ./ channels/ conf...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Oct 27 09:07:10 CDT 2008


Author: moy
Date: Mon Oct 27 09:07:10 2008
New Revision: 152131

URL: http://svn.digium.com/view/asterisk?view=rev&rev=152131
Log:
merged changes from 1.2.30.2

Added:
    team/moy/mfcr2-1.2/.lastclean
      - copied unchanged from r152129, tags/1.2.30.2/.lastclean
    team/moy/mfcr2-1.2/.version
      - copied unchanged from r152129, tags/1.2.30.2/.version
    team/moy/mfcr2-1.2/ChangeLog
      - copied unchanged from r152129, tags/1.2.30.2/ChangeLog
Modified:
    team/moy/mfcr2-1.2/LICENSE
    team/moy/mfcr2-1.2/channels/chan_iax2.c
    team/moy/mfcr2-1.2/configs/iax.conf.sample
    team/moy/mfcr2-1.2/include/asterisk/astobj2.h
    team/moy/mfcr2-1.2/include/asterisk/compat.h

Modified: team/moy/mfcr2-1.2/LICENSE
URL: http://svn.digium.com/view/asterisk/team/moy/mfcr2-1.2/LICENSE?view=diff&rev=152131&r1=152130&r2=152131
==============================================================================
--- team/moy/mfcr2-1.2/LICENSE (original)
+++ team/moy/mfcr2-1.2/LICENSE Mon Oct 27 09:07:10 2008
@@ -58,7 +58,7 @@
 +1.877.546.8963 (via telephone in the USA)
 +1.256.428.6000 (via telephone outside the USA)
 +1.256.864.0464 (via FAX inside or outside the USA)
-IAX2/misery.digium.com/6000 (via IAX2)
+IAX2/pbx.digium.com (via IAX2)
 licensing at digium.com (via email)
 
 Digium, Inc.

Modified: team/moy/mfcr2-1.2/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/moy/mfcr2-1.2/channels/chan_iax2.c?view=diff&rev=152131&r1=152130&r2=152131
==============================================================================
--- team/moy/mfcr2-1.2/channels/chan_iax2.c (original)
+++ team/moy/mfcr2-1.2/channels/chan_iax2.c Mon Oct 27 09:07:10 2008
@@ -272,6 +272,7 @@
 	IAX_DELAYPBXSTART =	(1 << 25),	/*!< Don't start a PBX on the channel until the peer sends us a
 						     response, so that we've achieved a three-way handshake with
 						     them before sending voice or anything else*/
+	IAX_ALLOWFWDOWNLOAD = (1 << 26),	/*!< Allow the FWDOWNL command? */
 } iax2_flags;
 
 static int global_rtautoclear = 120;
@@ -1282,7 +1283,7 @@
  		}
 
 		/* Look for an existing connection first */
-		for (x=1;(res < 1) && (x<maxnontrunkcall);x++) {
+		for (x=2;(res < 1) && (x<maxnontrunkcall);x++) {
 			ast_mutex_lock(&iaxsl[x]);
 			if (iaxs[x]) {
 				/* Look for an exact match */
@@ -1317,10 +1318,10 @@
 
 		gettimeofday(&now, NULL);
 
-		start = 1 + (rand() % (TRUNK_CALL_START - 1));
+		start = 2 + (rand() % (TRUNK_CALL_START - 1));
 		for (x = start; 1; x++) {
 			if (x == TRUNK_CALL_START) {
-				x = 0;
+				x = 1;
 				continue;
 			}
 
@@ -3097,6 +3098,15 @@
 	char *context;
 	char *options;
 };
+
+static int send_apathetic_reply(unsigned short callno, unsigned short dcallno, struct sockaddr_in *sin, int command, int ts, unsigned char seqno)
+{
+	struct ast_iax2_full_hdr f = { .scallno = htons(0x8000 | callno), .dcallno = htons(dcallno),
+		.ts = htonl(ts), .iseqno = seqno, .oseqno = seqno, .type = AST_FRAME_IAX,
+		.csub = compress_subclass(command) };
+
+	return sendto(defaultsockfd, &f, sizeof(f), 0, (struct sockaddr *)sin, sizeof(*sin));
+}
 
 /*!
  * \brief Parses an IAX dial string into its component parts.
@@ -6828,6 +6838,17 @@
 		} else {
 			f.subclass = uncompress_subclass(fh->csub);
 		}
+
+		/* Deal with POKE/PONG without allocating a callno */
+		if (f.frametype == AST_FRAME_IAX && f.subclass == IAX_COMMAND_POKE) {
+			/* Reply back with a PONG, but don't care about the result. */
+			send_apathetic_reply(1, ntohs(fh->scallno), &sin, IAX_COMMAND_PONG, ntohs(fh->ts), fh->oseqno);
+			return 1;
+		} else if (f.frametype == AST_FRAME_IAX && f.subclass == IAX_COMMAND_ACK && dcallno == 1) {
+			/* Ignore */
+			return 1;
+		}
+
 		if ((f.frametype == AST_FRAME_IAX) && ((f.subclass == IAX_COMMAND_NEW) || (f.subclass == IAX_COMMAND_REGREQ) ||
 						       (f.subclass == IAX_COMMAND_POKE) || (f.subclass == IAX_COMMAND_FWDOWNL) ||
 						       (f.subclass == IAX_COMMAND_REGREL)))
@@ -7921,6 +7942,10 @@
 				break;
 			case IAX_COMMAND_FWDOWNL:
 				/* Firmware download */
+				if (!ast_test_flag(&globalflags, IAX_ALLOWFWDOWNLOAD)) {
+					send_command_final(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_UNSUPPORT, 0, NULL, 0, -1);
+					break;
+				}
 				memset(&ied0, 0, sizeof(ied0));
 				res = iax_firmware_append(&ied0, (unsigned char *)ies.devicetype, ies.fwdesc);
 				if (res < 0)
@@ -9188,6 +9213,8 @@
 			delayreject = ast_true(v->value);
 		else if (!strcasecmp(v->name, "mailboxdetail"))
 			ast_set2_flag((&globalflags), ast_true(v->value), IAX_MESSAGEDETAIL);	
+		else if (!strcasecmp(v->name, "allowfwdownload"))
+			ast_set2_flag((&globalflags), ast_true(v->value), IAX_ALLOWFWDOWNLOAD);
 		else if (!strcasecmp(v->name, "rtcachefriends"))
 			ast_set2_flag((&globalflags), ast_true(v->value), IAX_RTCACHEFRIENDS);	
 		else if (!strcasecmp(v->name, "rtignoreregexpire"))

Modified: team/moy/mfcr2-1.2/configs/iax.conf.sample
URL: http://svn.digium.com/view/asterisk/team/moy/mfcr2-1.2/configs/iax.conf.sample?view=diff&rev=152131&r1=152130&r2=152131
==============================================================================
--- team/moy/mfcr2-1.2/configs/iax.conf.sample (original)
+++ team/moy/mfcr2-1.2/configs/iax.conf.sample Mon Oct 27 09:07:10 2008
@@ -255,6 +255,16 @@
 ; The default value is 'host'
 ;
 ;codecpriority=host
+;
+; allowfwdownload controls whether this host will serve out firmware to
+; IAX clients which request it.  This has only been used for the IAXy,
+; and it has been recently proven that this firmware distribution method
+; can be used as a source of traffic amplification attacks.  Also, the
+; IAXy firmware has not been updated for at least 18 months, so unless
+; you are provisioning IAXys in a secure network, we recommend that you
+; leave this option to the default, off.
+;
+;allowfwdownload=yes
 
 ;rtcachefriends=yes		; Cache realtime friends by adding them to the internal list
 				; just like friends added from the config file only on a

Modified: team/moy/mfcr2-1.2/include/asterisk/astobj2.h
URL: http://svn.digium.com/view/asterisk/team/moy/mfcr2-1.2/include/asterisk/astobj2.h?view=diff&rev=152131&r1=152130&r2=152131
==============================================================================
--- team/moy/mfcr2-1.2/include/asterisk/astobj2.h (original)
+++ team/moy/mfcr2-1.2/include/asterisk/astobj2.h Mon Oct 27 09:07:10 2008
@@ -16,6 +16,8 @@
 
 #ifndef _ASTERISK_ASTOBJ2_H
 #define _ASTERISK_ASTOBJ2_H
+
+#include "asterisk/compat.h"
 
 /*! \file 
  *

Modified: team/moy/mfcr2-1.2/include/asterisk/compat.h
URL: http://svn.digium.com/view/asterisk/team/moy/mfcr2-1.2/include/asterisk/compat.h?view=diff&rev=152131&r1=152130&r2=152131
==============================================================================
--- team/moy/mfcr2-1.2/include/asterisk/compat.h (original)
+++ team/moy/mfcr2-1.2/include/asterisk/compat.h Mon Oct 27 09:07:10 2008
@@ -54,6 +54,7 @@
 typedef unsigned char	u_int8_t;
 typedef unsigned short	u_int16_t;
 typedef unsigned int	u_int32_t;
+typedef unsigned int	uint;
 #endif
 
 char* strsep(char** str, const char* delims);




More information about the asterisk-commits mailing list