[asterisk-commits] file: branch file/chan_jingle2 r365457 - /team/file/chan_jingle2/res/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sun May 6 10:01:20 CDT 2012
Author: file
Date: Sun May 6 10:01:16 2012
New Revision: 365457
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=365457
Log:
Do not apply probation to STUN packets.
Modified:
team/file/chan_jingle2/res/res_rtp_asterisk.c
Modified: team/file/chan_jingle2/res/res_rtp_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/file/chan_jingle2/res/res_rtp_asterisk.c?view=diff&rev=365457&r1=365456&r2=365457
==============================================================================
--- team/file/chan_jingle2/res/res_rtp_asterisk.c (original)
+++ team/file/chan_jingle2/res/res_rtp_asterisk.c Sun May 6 10:01:16 2012
@@ -2834,39 +2834,6 @@
return &ast_null_frame;
}
- /* If strict RTP protection is enabled see if we need to learn the remote address or if we need to drop the packet */
- if (rtp->strict_rtp_state == STRICT_RTP_LEARN) {
- ast_debug(1, "%p -- start learning mode pass with addr = %s\n", rtp, ast_sockaddr_stringify(&addr));
- /* For now, we always copy the address. */
- ast_sockaddr_copy(&rtp->strict_rtp_address, &addr);
-
- /* Send the rtp and the seqno from header to rtp_learning_rtp_seq_update to see whether we can exit or not*/
- if (rtp_learning_rtp_seq_update(rtp, ntohl(rtpheader[0]))) {
- ast_debug(1, "%p -- Condition for learning hasn't exited, so reject the frame.\n", rtp);
- return &ast_null_frame;
- }
-
- ast_debug(1, "%p -- Probation Ended. Set strict_rtp_state to STRICT_RTP_CLOSED with address %s\n", rtp, ast_sockaddr_stringify(&addr));
- rtp->strict_rtp_state = STRICT_RTP_CLOSED;
- } else if (rtp->strict_rtp_state == STRICT_RTP_CLOSED) {
- if (ast_sockaddr_cmp(&rtp->strict_rtp_address, &addr)) {
- /* Hmm, not the strict addres. Perhaps we're getting audio from the alternate? */
- if (!ast_sockaddr_cmp(&rtp->alt_rtp_address, &addr)) {
- /* ooh, we did! You're now the new expected address, son! */
- ast_sockaddr_copy(&rtp->strict_rtp_address,
- &addr);
- } else {
- const char *real_addr = ast_strdupa(ast_sockaddr_stringify(&addr));
- const char *expected_addr = ast_strdupa(ast_sockaddr_stringify(&rtp->strict_rtp_address));
-
- ast_debug(1, "Received RTP packet from %s, dropping due to strict RTP protection. Expected it to be from %s\n",
- real_addr, expected_addr);
-
- return &ast_null_frame;
- }
- }
- }
-
/* Get fields and verify this is an RTP packet */
seqno = ntohl(rtpheader[0]);
@@ -2892,6 +2859,39 @@
ast_rtp_instance_set_remote_address(instance, &addr);
}
return &ast_null_frame;
+ }
+
+ /* If strict RTP protection is enabled see if we need to learn the remote address or if we need to drop the packet */
+ if (rtp->strict_rtp_state == STRICT_RTP_LEARN) {
+ ast_debug(1, "%p -- start learning mode pass with addr = %s\n", rtp, ast_sockaddr_stringify(&addr));
+ /* For now, we always copy the address. */
+ ast_sockaddr_copy(&rtp->strict_rtp_address, &addr);
+
+ /* Send the rtp and the seqno from header to rtp_learning_rtp_seq_update to see whether we can exit or not*/
+ if (rtp_learning_rtp_seq_update(rtp, ntohl(rtpheader[0]))) {
+ ast_debug(1, "%p -- Condition for learning hasn't exited, so reject the frame.\n", rtp);
+ return &ast_null_frame;
+ }
+
+ ast_debug(1, "%p -- Probation Ended. Set strict_rtp_state to STRICT_RTP_CLOSED with address %s\n", rtp, ast_sockaddr_stringify(&addr));
+ rtp->strict_rtp_state = STRICT_RTP_CLOSED;
+ } else if (rtp->strict_rtp_state == STRICT_RTP_CLOSED) {
+ if (ast_sockaddr_cmp(&rtp->strict_rtp_address, &addr)) {
+ /* Hmm, not the strict addres. Perhaps we're getting audio from the alternate? */
+ if (!ast_sockaddr_cmp(&rtp->alt_rtp_address, &addr)) {
+ /* ooh, we did! You're now the new expected address, son! */
+ ast_sockaddr_copy(&rtp->strict_rtp_address,
+ &addr);
+ } else {
+ const char *real_addr = ast_strdupa(ast_sockaddr_stringify(&addr));
+ const char *expected_addr = ast_strdupa(ast_sockaddr_stringify(&rtp->strict_rtp_address));
+
+ ast_debug(1, "Received RTP packet from %s, dropping due to strict RTP protection. Expected it to be from %s\n",
+ real_addr, expected_addr);
+
+ return &ast_null_frame;
+ }
+ }
}
/* If symmetric RTP is enabled see if the remote side is not what we expected and change where we are sending audio */
More information about the asterisk-commits
mailing list