[asterisk-commits] trunk r31050 - /trunk/channels/chan_sip.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Wed May 31 09:31:42 MST 2006
Author: file
Date: Wed May 31 11:31:41 2006
New Revision: 31050
URL: http://svn.digium.com/view/asterisk?rev=31050&view=rev
Log:
OKAY - Only replace our IP address in the outgoing SIP messages if the actual source address is within the specified local network. (issue #7051 reported by Luke-Jr with mods by me)
Modified:
trunk/channels/chan_sip.c
Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=31050&r1=31049&r2=31050&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Wed May 31 11:31:41 2006
@@ -1456,11 +1456,16 @@
* apply it to their address to see if we need to substitute our
* externip or can get away with our internal bindaddr
*/
- struct sockaddr_in theirs;
+ struct sockaddr_in theirs, ours;
+
+ /* Get our local information */
+ ast_ouraddrfor(them, us);
theirs.sin_addr = *them;
+ ours.sin_addr = *us;
if (localaddr && externip.sin_addr.s_addr &&
- ast_apply_ha(localaddr, &theirs)) {
+ ast_apply_ha(localaddr, &theirs) &&
+ !ast_apply_ha(localaddr, &ours)) {
if (externexpire && time(NULL) >= externexpire) {
struct ast_hostent ahp;
struct hostent *hp;
@@ -1480,8 +1485,6 @@
}
} else if (bindaddr.sin_addr.s_addr)
*us = bindaddr.sin_addr;
- else
- return ast_ouraddrfor(them, us);
return 0;
}
More information about the asterisk-commits
mailing list