]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix a bug where the flag indicating the presence of rport would get overwritten by...
authorJoshua Colp <jcolp@digium.com>
Thu, 28 May 2009 13:44:58 +0000 (13:44 +0000)
committerJoshua Colp <jcolp@digium.com>
Thu, 28 May 2009 13:44:58 +0000 (13:44 +0000)
The presence of rport is now stored as a separate flag. Once the dialog is setup and authenticated
(or it passes through unauthenticated) the proper nat flag is set.

(closes issue #13823)
Reported by: dimas

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@197466 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 82233b929fdb301b64e40936273c6c2b5646c01c..b457d4fe28b9e1c7c2bd800fffff0b0daacd4c8b 100644 (file)
@@ -803,6 +803,7 @@ struct sip_auth {
 #define SIP_PAGE2_OUTGOING_CALL         (1 << 27)       /*!< 27: Is this an outgoing call? */
 #define SIP_PAGE2_UDPTL_DESTINATION     (1 << 28)       /*!< 28: Use source IP of RTP as destination if NAT is enabled */
 #define SIP_PAGE2_DIALOG_ESTABLISHED    (1 << 29)       /*!< 29: Has a dialog been established? */
+#define SIP_PAGE2_RPORT_PRESENT         (1 << 30)       /*!< 30: Was rport received in the Via header? */
 
 #define SIP_PAGE2_FLAGS_TO_COPY \
        (SIP_PAGE2_ALLOWSUBSCRIBE | SIP_PAGE2_ALLOWOVERLAP | SIP_PAGE2_VIDEOSUPPORT | \
@@ -9580,7 +9581,7 @@ static void check_via(struct sip_pvt *p, const struct sip_request *req)
        /* Check for rport */
        c = strstr(via, ";rport");
        if (c && (c[6] != '=')) /* rport query, not answer */
-               ast_set_flag(&p->flags[0], SIP_NAT_ROUTE);
+               ast_set_flag(&p->flags[1], SIP_PAGE2_RPORT_PRESENT);
 
        c = strchr(via, ';');
        if (c) 
@@ -10013,6 +10014,11 @@ static enum check_auth_result check_user_full(struct sip_pvt *p, struct sip_requ
 
        if (user)
                ASTOBJ_UNREF(user, sip_destroy_user);
+
+       if (ast_test_flag(&p->flags[1], SIP_PAGE2_RPORT_PRESENT)) {
+               ast_set_flag(&p->flags[0], SIP_NAT_ROUTE);
+       }
+
        return res;
 }