summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2006-05-31 16:31:41 +0000
committerJoshua Colp <jcolp@digium.com>2006-05-31 16:31:41 +0000
commit503486e99d5bd1eb6ace4f62b3d6f4488b97b323 (patch)
treebe222358eb89dd774ca196e961a1fd7ce994204b /channels
parent7f3cc8b8866a5624182f586679a88d30b173e64c (diff)
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)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@31050 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index f338d95e9..d3f329deb 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -1456,11 +1456,16 @@ static int ast_sip_ouraddrfor(struct in_addr *them, struct in_addr *us)
* 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 @@ static int ast_sip_ouraddrfor(struct in_addr *them, struct in_addr *us)
}
} else if (bindaddr.sin_addr.s_addr)
*us = bindaddr.sin_addr;
- else
- return ast_ouraddrfor(them, us);
return 0;
}