[asterisk-commits] tilghman: trunk r132778 - in /trunk: ./ channels/ configs/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jul 22 16:53:40 CDT 2008
Author: tilghman
Date: Tue Jul 22 16:53:40 2008
New Revision: 132778
URL: http://svn.digium.com/view/asterisk?view=rev&rev=132778
Log:
Merged revisions 132713 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
................
r132713 | tilghman | 2008-07-22 16:19:39 -0500 (Tue, 22 Jul 2008) | 10 lines
Merged revisions 132711 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r132711 | tilghman | 2008-07-22 16:14:10 -0500 (Tue, 22 Jul 2008) | 2 lines
Fixes for AST-2008-010 and AST-2008-011
........
................
Modified:
trunk/ (props changed)
trunk/channels/chan_iax2.c
trunk/configs/iax.conf.sample
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=132778&r1=132777&r2=132778
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Tue Jul 22 16:53:40 2008
@@ -276,6 +276,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? */
};
static int global_rtautoclear = 120;
@@ -1727,10 +1728,10 @@
snprintf(host, sizeof(host), "%s:%d", ast_inet_ntoa(sin->sin_addr), ntohs(sin->sin_port));
now = ast_tvnow();
- start = 1 + (ast_random() % (TRUNK_CALL_START - 1));
+ start = 2 + (ast_random() % (TRUNK_CALL_START - 1));
for (x = start; 1; x++) {
if (x == TRUNK_CALL_START) {
- x = 0;
+ x = 1;
continue;
}
@@ -3482,6 +3483,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.
@@ -7995,6 +8005,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)))
@@ -9382,6 +9403,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)
@@ -11029,6 +11054,8 @@
ast_set2_flag((&globalflags), ast_true(v->value), IAX_FORCEJITTERBUF);
else if (!strcasecmp(v->name, "delayreject"))
delayreject = ast_true(v->value);
+ 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: trunk/configs/iax.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/iax.conf.sample?view=diff&rev=132778&r1=132777&r2=132778
==============================================================================
--- trunk/configs/iax.conf.sample (original)
+++ trunk/configs/iax.conf.sample Tue Jul 22 16:53:40 2008
@@ -264,6 +264,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
More information about the asterisk-commits
mailing list