[Freeswitch-svn] [commit] r1580 - freeswitch/trunk/src

anthm at freeswitch.org anthm at freeswitch.org
Thu Jun 8 20:40:04 EDT 2006


Author: anthm
Date: Thu Jun  8 20:40:04 2006
New Revision: 1580

Modified:
   freeswitch/trunk/src/switch_rtp.c

Log:
just in case make autoadj harder for spoofers

Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c	(original)
+++ freeswitch/trunk/src/switch_rtp.c	Thu Jun  8 20:40:04 2006
@@ -787,19 +787,21 @@
 
 
 		if (rtp_session->recv_msg.header.version) {
-			if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ) && rtp_session->from_addr->port && 
-				(rtp_session->from_addr->port != rtp_session->remote_port)) {
-				const char *err;
-				char *tx_host;
-				uint32_t old = rtp_session->remote_port;
-				char *old_host;
+			if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ) && rtp_session->from_addr->port) {
+				if ((rtp_session->from_addr->port != rtp_session->remote_port)) {
+					const char *err;
+					char *tx_host;
+					uint32_t old = rtp_session->remote_port;
+					char *old_host;
 				
-				switch_sockaddr_ip_get(&tx_host, rtp_session->from_addr);
-				switch_sockaddr_ip_get(&old_host, rtp_session->remote_addr);
-
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Auto Changing port from %s:%u to %s:%u\n",
-								  old_host, old, tx_host, rtp_session->from_addr->port);
-				switch_rtp_set_remote_address(rtp_session, tx_host, rtp_session->from_addr->port, &err);
+					switch_sockaddr_ip_get(&tx_host, rtp_session->from_addr);
+					switch_sockaddr_ip_get(&old_host, rtp_session->remote_addr);
+					
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Auto Changing port from %s:%u to %s:%u\n",
+									  old_host, old, tx_host, rtp_session->from_addr->port);
+					switch_rtp_set_remote_address(rtp_session, tx_host, rtp_session->from_addr->port, &err);
+				}
+				switch_clear_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
 			}
 		}
 



More information about the Freeswitch-svn mailing list