[Pkg-voip-commits] [asterisk] 02/02: Import upstream fix to set the RTP source address to the address bound by the PJSIP transport

Bernhard Schmidt berni at moszumanska.debian.org
Sun Apr 9 19:54:34 UTC 2017


This is an automated email from the git hooks/post-receive script.

berni pushed a commit to branch master
in repository asterisk.

commit 88e00f2be1608fdf8b4614d6b473b5f633996b21
Author: Bernhard Schmidt <berni at debian.org>
Date:   Sun Apr 9 21:53:11 2017 +0200

    Import upstream fix to set the RTP source address to the address bound by the PJSIP transport
    
    Closes: #859911
---
 ...859911-pjsip-set-rtp-source-address-part2.patch | 62 ++++++++++++++++++++++
 .../859911-pjsip-set-rtp-source-address.patch      | 47 ++++++++++++++++
 debian/patches/series                              |  4 ++
 3 files changed, 113 insertions(+)

diff --git a/debian/patches/859911-pjsip-set-rtp-source-address-part2.patch b/debian/patches/859911-pjsip-set-rtp-source-address-part2.patch
new file mode 100644
index 0000000..cc5c674
--- /dev/null
+++ b/debian/patches/859911-pjsip-set-rtp-source-address-part2.patch
@@ -0,0 +1,62 @@
+From 2634f48fb57e1358ad1de0683e9779cc05efe2c4 Mon Sep 17 00:00:00 2001
+From: Richard Mudgett <rmudgett at digium.com>
+Date: Mon, 3 Apr 2017 15:38:06 -0500
+Subject: [PATCH] res_pjsip_sdp_rtp.c: Don't alter global addr variable.
+
+* create_rtp(): Fix unexpected alteration of global address_rtp if a
+transport is bound to an address.
+
+* create_rtp(): Fix use of uninitialized memory if the endpoint RTP media
+address is invalid or the transport has an invalid address.
+
+ASTERISK-26851
+
+Change-Id: Icde42e65164a88913cb5c2601b285eebcff397b7
+---
+ res/res_pjsip_sdp_rtp.c | 23 ++++++++++++++++++-----
+ 1 file changed, 18 insertions(+), 5 deletions(-)
+
+diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
+index d44171cf8f..4cfd4d5b4a 100644
+--- a/res/res_pjsip_sdp_rtp.c
++++ b/res/res_pjsip_sdp_rtp.c
+@@ -194,8 +194,16 @@ static int create_rtp(struct ast_sip_session *session, struct ast_sip_session_me
+ 	struct ast_sockaddr *media_address =  &address_rtp;
+ 
+ 	if (session->endpoint->media.bind_rtp_to_media_address && !ast_strlen_zero(session->endpoint->media.address)) {
+-		ast_sockaddr_parse(&temp_media_address, session->endpoint->media.address, 0);
+-		media_address = &temp_media_address;
++		if (ast_sockaddr_parse(&temp_media_address, session->endpoint->media.address, 0)) {
++			ast_debug(1, "Endpoint %s: Binding RTP media to %s\n",
++				ast_sorcery_object_get_id(session->endpoint),
++				session->endpoint->media.address);
++			media_address = &temp_media_address;
++		} else {
++			ast_debug(1, "Endpoint %s: RTP media address invalid: %s\n",
++				ast_sorcery_object_get_id(session->endpoint),
++				session->endpoint->media.address);
++		}
+ 	} else {
+ 		struct ast_sip_transport *transport =
+ 			ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "transport",
+@@ -205,9 +213,14 @@ static int create_rtp(struct ast_sip_session *session, struct ast_sip_session_me
+ 			char hoststr[PJ_INET6_ADDRSTRLEN];
+ 
+ 			pj_sockaddr_print(&transport->state->host, hoststr, sizeof(hoststr), 0);
+-			ast_debug(1, "Transport: %s bound to host: %s, using this for media.\n",
+-					  session->endpoint->transport, hoststr);
+-			ast_sockaddr_parse(media_address, hoststr, 0);
++			if (ast_sockaddr_parse(&temp_media_address, hoststr, 0)) {
++				ast_debug(1, "Transport %s bound to %s: Using it for RTP media.\n",
++					session->endpoint->transport, hoststr);
++				media_address = &temp_media_address;
++			} else {
++				ast_debug(1, "Transport %s bound to %s: Invalid for RTP media.\n",
++					session->endpoint->transport, hoststr);
++			}
+ 		}
+ 		ao2_cleanup(transport);
+ 	}
+-- 
+2.11.0
+
diff --git a/debian/patches/859911-pjsip-set-rtp-source-address.patch b/debian/patches/859911-pjsip-set-rtp-source-address.patch
new file mode 100644
index 0000000..6ca3884
--- /dev/null
+++ b/debian/patches/859911-pjsip-set-rtp-source-address.patch
@@ -0,0 +1,47 @@
+From 139bc3495f8f46201b4aac6c84a5f0d04822f9da Mon Sep 17 00:00:00 2001
+From: Richard Begg <asterisk at meric.id.au>
+Date: Wed, 15 Mar 2017 08:22:42 +1100
+Subject: [PATCH] res_pjsip_sdp_rtp: RTP instance does not use same IP as
+ explicit transport
+
+Currently a wildcard address is used for the local RTP socket, which
+will not always result in the same address as used by the SIP socket
+(e.g. if explicit transport addresses are configured).
+Use the transport's host address when binding new local RTP sockets if
+available.
+
+ASTERISK-26851
+
+Change-Id: I098c29c9d1f79a4f970d72ba894874ac75954f1a
+---
+ res/res_pjsip_sdp_rtp.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
+index b27050ed86..2b31d146ea 100644
+--- a/res/res_pjsip_sdp_rtp.c
++++ b/res/res_pjsip_sdp_rtp.c
+@@ -179,6 +179,20 @@ static int create_rtp(struct ast_sip_session *session, struct ast_sip_session_me
+ 	if (session->endpoint->media.bind_rtp_to_media_address && !ast_strlen_zero(session->endpoint->media.address)) {
+ 		ast_sockaddr_parse(&temp_media_address, session->endpoint->media.address, 0);
+ 		media_address = &temp_media_address;
++	} else {
++		struct ast_sip_transport *transport =
++			ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "transport",
++									   session->endpoint->transport);
++
++		if (transport && transport->state) {
++			char hoststr[PJ_INET6_ADDRSTRLEN];
++
++			pj_sockaddr_print(&transport->state->host, hoststr, sizeof(hoststr), 0);
++			ast_debug(1, "Transport: %s bound to host: %s, using this for media.\n",
++					  session->endpoint->transport, hoststr);
++			ast_sockaddr_parse(media_address, hoststr, 0);
++		}
++		ao2_cleanup(transport);
+ 	}
+ 
+ 	if (!(session_media->rtp = ast_rtp_instance_new(session->endpoint->media.rtp.engine, sched, media_address, NULL))) {
+-- 
+2.11.0
+
diff --git a/debian/patches/series b/debian/patches/series
index ccd866f..6bed176 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -38,3 +38,7 @@ OpenSSL-1.1.0-support-2.patch
 OpenSSL-1.1.0-support-3.patch
 
 pjsip_unresolved_symbol.patch
+
+# Bug#859911 - res_pjsip_sdp_rtp: RTP instance does not use same IP as explicit transport
+859911-pjsip-set-rtp-source-address.patch
+859911-pjsip-set-rtp-source-address-part2.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/asterisk.git



More information about the Pkg-voip-commits mailing list