summaryrefslogtreecommitdiff
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
authorMichael L. Young <elgueromexicano@gmail.com>2013-10-17 20:39:29 +0000
committerMichael L. Young <elgueromexicano@gmail.com>2013-10-17 20:39:29 +0000
commit42f3cae1fd3ae84b79f5b0b63d6a410be9f946eb (patch)
tree9583bea9093db2b6650de5c5ef80863af7da64c3 /channels/chan_sip.c
parent9a451737152207c92b4418e0e9efd7e4de7ac41c (diff)
Fix Setting A chan_sip Dialog's SIP_NAT_FORCE_RPORT Flag
A condition was added in a commit to fix ASTERISK-21374, that, if the SIP_PAGE3_NAT_AUTO_RPORT flag was set, to then copy a peer's SIP_NAT_FORCE_RPORT flag to the dialog. This condition should not have been there since it assumed that if Asterisk is in an environment where NAT is involved, that the auto_* nat settings or force_rport setting would be on in the global settings. If the nat setting in the global setting is set to 'nat=no' and then turned on for peers (which is not quite the recommended way, although it is allowed) this flag is never copied to the dialog resulting in problems like, REGISTER replies going to the wrong port. This patch removes this conditional check and will now always use the peer's flag which by this point in the code the checks on whether the peer is behind NAT or not (if using auto_force_rport) have already been run. (closes issue ASTERISK-22236) Reported by: Filip Frank Tested by: Michael L. Young Patches: asterisk-2236-always-set-rport.diff uploaded by Michael L. Young (license 5026) Review: https://reviewboard.asterisk.org/r/2919/ ........ Merged revisions 401167 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 401168 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@401169 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r--channels/chan_sip.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 44077ab71..473619f22 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -17266,9 +17266,8 @@ static enum check_auth_result register_verify(struct sip_pvt *p, struct ast_sock
} else {
set_peer_nat(p, peer);
- if (p->natdetected && ast_test_flag(&p->flags[2], SIP_PAGE3_NAT_AUTO_RPORT)) {
- ast_copy_flags(&p->flags[0], &peer->flags[0], SIP_NAT_FORCE_RPORT);
- }
+
+ ast_copy_flags(&p->flags[0], &peer->flags[0], SIP_NAT_FORCE_RPORT);
if (!(res = check_auth(p, req, peer->name, peer->secret, peer->md5secret, SIP_REGISTER, uri2, XMIT_UNRELIABLE))) {
if (sip_cancel_destroy(p))