Skip to content
This repository has been archived by the owner on Jan 14, 2020. It is now read-only.

Commit

Permalink
OKAY - Only replace our IP address in the outgoing SIP messages if th…
Browse files Browse the repository at this point in the history
…e actual source address is within the specified local network. (issue #7051 reported by Luke-Jr with mods by me)

git-svn-id: http://svn.asterisk.org/svn/asterisk/trunk@31050 f38db490-d61c-443f-a65b-d21fe96a405b
  • Loading branch information
jcolp committed May 31, 2006
1 parent 41b65ca commit d5d491f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions channels/chan_sip.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down

0 comments on commit d5d491f

Please sign in to comment.