[asterisk-commits] chan iax2: Reload of iax peer results in loss of host addres... (asterisk[14])
    SVN commits to the Asterisk project 
    asterisk-commits at lists.digium.com
       
    Wed Mar 15 22:03:35 CDT 2017
    
    
  
Anonymous Coward #1000019 has submitted this change and it was merged. ( https://gerrit.asterisk.org/5204 )
Change subject: chan_iax2: Reload of iax peer results in loss of host address/port
......................................................................
chan_iax2: Reload of iax peer results in loss of host address/port
When using a non-dynamic peer address, build_peer() invalidates the
peer address structure by setting the address family to unspecified.
However, if dnsmgr is enabled, the subsequent call to ast_dnsmgr_lookup()
will not amend the peer address if the cache is still valid, resulting
in peer connectivity failures.
To fix this, we call ast_dnsmgr_refresh() instead.
ASTERISK-26865
Change-Id: Id8a89a2f771ebbaf32255a35fe596a6dcb97a082
---
M channels/chan_iax2.c
1 file changed, 7 insertions(+), 1 deletion(-)
Approvals:
  Mark Michelson: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 456ba8f..469a172 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -12908,7 +12908,13 @@
 					/* Non-dynamic.  Make sure we become that way if we're not */
 					AST_SCHED_DEL(sched, peer->expire);
 					ast_clear_flag64(peer, IAX_DYNAMIC);
-					peer->addr.ss.ss_family = AST_AF_UNSPEC;
+					if (peer->dnsmgr) {
+						// Make sure we refresh dnsmgr if we're using it
+						ast_dnsmgr_refresh(peer->dnsmgr);
+					} else {
+						// Or just invalidate the address
+						peer->addr.ss.ss_family = AST_AF_UNSPEC;
+					}
 					if (ast_dnsmgr_lookup(v->value, &peer->addr, &peer->dnsmgr, srvlookup ? "_iax._udp" : NULL)) {
 						return peer_unref(peer);
 					}
-- 
To view, visit https://gerrit.asterisk.org/5204
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id8a89a2f771ebbaf32255a35fe596a6dcb97a082
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-Owner: Richard Begg <asterisk at meric.id.au>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
    
    
More information about the asterisk-commits
mailing list