[Asterisk-code-review] res/res pjsip session: Only check localnet if it is defined (asterisk[master])

Matt Jordan asteriskteam at digium.com
Thu Mar 16 10:47:12 CDT 2017


Matt Jordan has uploaded a new change for review. ( https://gerrit.asterisk.org/5231 )

Change subject: res/res_pjsip_session: Only check localnet if it is defined
......................................................................

res/res_pjsip_session: Only check localnet if it is defined

If local_net is not defined on a transport, transport_state->localnet
will be NULL. ast_apply_ha will, be default, return AST_SENSE_ALLOW in
this case, causing the external_media_address, if set, to be skipped.

This patch causes us to only check if we are sending within a network if
local_net is defined.

ASTERISK-26879 #close

Change-Id: Ib661c31a954cabc9c99f1f25c9c9a5c5b82cbbfb
---
M res/res_pjsip_sdp_rtp.c
M res/res_pjsip_session.c
M res/res_pjsip_t38.c
3 files changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/31/5231/1

diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
index 9f39256..b4cd6ee 100644
--- a/res/res_pjsip_sdp_rtp.c
+++ b/res/res_pjsip_sdp_rtp.c
@@ -1473,7 +1473,7 @@
 	ast_sockaddr_parse(&addr, host, PARSE_PORT_FORBID);
 
 	/* Is the address within the SDP inside the same network? */
-	if (ast_apply_ha(transport_state->localnet, &addr) == AST_SENSE_ALLOW) {
+	if (transport_state->localnet && ast_apply_ha(transport_state->localnet, &addr) == AST_SENSE_ALLOW) {
 		return;
 	}
 
diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index ad9670c..4253b43 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -3148,7 +3148,7 @@
 		ast_copy_pj_str(host, &sdp->conn->addr, sizeof(host));
 		ast_sockaddr_parse(&addr, host, PARSE_PORT_FORBID);
 
-		if (ast_apply_ha(transport_state->localnet, &addr) != AST_SENSE_ALLOW) {
+		if (!transport_state->localnet || (transport_state->localnet && ast_apply_ha(transport_state->localnet, &addr) != AST_SENSE_ALLOW)) {
 			pj_strdup2(tdata->pool, &sdp->conn->addr, transport->external_media_address);
 		}
 	}
diff --git a/res/res_pjsip_t38.c b/res/res_pjsip_t38.c
index 79dc9c3..ddc6c96 100644
--- a/res/res_pjsip_t38.c
+++ b/res/res_pjsip_t38.c
@@ -867,7 +867,7 @@
 	ast_sockaddr_parse(&addr, host, PARSE_PORT_FORBID);
 
 	/* Is the address within the SDP inside the same network? */
-	if (ast_apply_ha(transport_state->localnet, &addr) == AST_SENSE_ALLOW) {
+	if (transport_state->localnet && ast_apply_ha(transport_state->localnet, &addr) == AST_SENSE_ALLOW) {
 		return;
 	}
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib661c31a954cabc9c99f1f25c9c9a5c5b82cbbfb
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>



More information about the asterisk-code-review mailing list