[svn-commits] jpeeler: branch jpeeler/sip-dnsmgr r111670 - in /team/jpeeler/sip-dnsmgr: cha...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Mar 28 11:50:32 CDT 2008


Author: jpeeler
Date: Fri Mar 28 11:50:31 2008
New Revision: 111670

URL: http://svn.digium.com/view/asterisk?view=rev&rev=111670
Log:
change of dns srv record port number is now updated properly

Modified:
    team/jpeeler/sip-dnsmgr/channels/chan_sip.c
    team/jpeeler/sip-dnsmgr/main/dnsmgr.c

Modified: team/jpeeler/sip-dnsmgr/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/sip-dnsmgr/channels/chan_sip.c?view=diff&rev=111670&r1=111669&r2=111670
==============================================================================
--- team/jpeeler/sip-dnsmgr/channels/chan_sip.c (original)
+++ team/jpeeler/sip-dnsmgr/channels/chan_sip.c Fri Mar 28 11:50:31 2008
@@ -9274,8 +9274,8 @@
 			return 0;
 		}
 
-		ast_log(LOG_DEBUG, "******************* sip_registry port set to %d\n", ntohs(r->us.sin_port));
-		ast_log(LOG_DEBUG, "******************* p->sa.sin_port=%d\n", ntohs(p->sa.sin_port));
+		ast_log(LOG_DEBUG, "sip_registry port set to %d\n", ntohs(r->us.sin_port));
+		ast_log(LOG_DEBUG, "p->sa.sin_port=%d\n", ntohs(p->sa.sin_port));
 
 
 		/* Copy back Call-ID in case create_addr changed it */

Modified: team/jpeeler/sip-dnsmgr/main/dnsmgr.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/sip-dnsmgr/main/dnsmgr.c?view=diff&rev=111670&r1=111669&r2=111670
==============================================================================
--- team/jpeeler/sip-dnsmgr/main/dnsmgr.c (original)
+++ team/jpeeler/sip-dnsmgr/main/dnsmgr.c Fri Mar 28 11:50:31 2008
@@ -48,7 +48,7 @@
 	struct in_addr *result;
 	/*! the last result, used to check if address has changed */
 	struct in_addr last;
-	unsigned short result_portno;
+	unsigned short *result_portno;
 	unsigned short last_portno;
 	char service[MAXHOSTNAMELEN];
 	int dnssrv:1;
@@ -110,12 +110,12 @@
 		return NULL;
 
 	entry->result = result;
-	entry->result_portno = *portno;
+	entry->result_portno = portno;
 	ast_mutex_init(&entry->lock);
 	strcpy(entry->name, name);
 	strcpy(entry->service, service);
 	memcpy(&entry->last, result, sizeof(entry->last));
-	//ast_log(LOG_DEBUG, "address of entry->last=%p", 
+	ast_log(LOG_DEBUG, "******************* entry->last_portno@%p entry->last@%p", &entry->last_portno, &entry->last);
 	entry->last_portno = *portno;
 	entry->dnssrv = 1;
 
@@ -199,7 +199,7 @@
 	if (srv_ret > 0) {
 		char buf[INET_ADDRSTRLEN];
 		hp = ast_gethostbyname(realhostname, &ahp);
-		*result_portno = htons((unsigned int)real_portno);
+		*result_portno = htons((unsigned short)real_portno);
 		ast_log(LOG_DEBUG, "name=%s realhostname=%s result_portno=%d hp->h_addr=%s\n", name, realhostname, ntohs(*result_portno), inet_ntop(AF_INET, hp->h_addr, buf, sizeof(buf)));
 		//result_addr->sin_port = *result_portno;
 	} else {
@@ -252,9 +252,7 @@
 					if (tmp.s_addr != entry->last.s_addr)
 						ast_log(LOG_DEBUG, "tmp != entry\n");
 					if (real_portno != ntohs(entry->last_portno))
-						ast_log(LOG_DEBUG, "real_portno != entry->last_portno\n");
-
-
+						ast_log(LOG_DEBUG, "real_portno (%d) != entry->last_portno (%d)\n", real_portno, ntohs(entry->last_portno));
 
 					ast_copy_string(iabuf, ast_inet_ntoa(entry->last), sizeof(iabuf));
 					ast_copy_string(iabuf2, ast_inet_ntoa(tmp), sizeof(iabuf2));
@@ -263,8 +261,8 @@
 
 					memcpy(entry->result, hp->h_addr, sizeof(entry->result));
 					memcpy(&entry->last, hp->h_addr, sizeof(entry->last));
-					entry->result_portno = htons((unsigned int)real_portno);
-					entry->last_portno = htons((unsigned int)real_portno);
+					*entry->result_portno = htons((unsigned short)real_portno);
+					entry->last_portno = htons((unsigned short)real_portno);
 					ast_log(LOG_DEBUG, "Verifying that new port has been accounted for, new port = %d\n", ntohs(entry->last_portno));
 					changed = entry->changed = 1;
 				}




More information about the svn-commits mailing list