[Asterisk-code-review] res rtp asterisk.c: Check RTP packet version earlier. (asterisk[13])

Jenkins2 asteriskteam at digium.com
Wed Sep 6 09:34:56 CDT 2017


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/6409 )

Change subject: res_rtp_asterisk.c: Check RTP packet version earlier.
......................................................................

res_rtp_asterisk.c: Check RTP packet version earlier.

Change-Id: Ic6493a7d79683f3e5845dff1cee49445fd5a0adf
---
M res/res_rtp_asterisk.c
1 file changed, 5 insertions(+), 5 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Jenkins2: Approved for Submit



diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index b6cef97..77027aa 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -5070,6 +5070,11 @@
 		return &ast_null_frame;
 	}
 
+	/* If the version is not what we expected by this point then just drop the packet */
+	if (version != 2) {
+		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) {
 		if (!ast_sockaddr_cmp(&rtp->strict_rtp_address, &addr)) {
@@ -5114,11 +5119,6 @@
 				ast_debug(0, "RTP NAT: Got audio from other end. Now sending to address %s\n",
 					  ast_sockaddr_stringify(&remote_address));
 		}
-	}
-
-	/* If the version is not what we expected by this point then just drop the packet */
-	if (version != 2) {
-		return &ast_null_frame;
 	}
 
 	/* Pull out the various other fields we will need */

-- 
To view, visit https://gerrit.asterisk.org/6409
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic6493a7d79683f3e5845dff1cee49445fd5a0adf
Gerrit-Change-Number: 6409
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20170906/47970e98/attachment.html>


More information about the asterisk-code-review mailing list