]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix bad behavior of dynamic_exclude_static option in sip.conf.
authorMark Michelson <mmichelson@digium.com>
Tue, 27 Jul 2010 15:13:24 +0000 (15:13 +0000)
committerMark Michelson <mmichelson@digium.com>
Tue, 27 Jul 2010 15:13:24 +0000 (15:13 +0000)
We were attempting to create a contactdeny rule based on the peer's
IP address before the peer's IP address had been set. By moving the
processing further down in the function, we can ensure stuff works
as we expect for it to.

(closes issue #17717)
Reported by: mmichelson
Patches:
      17717.patch uploaded by mmichelson (license 60)
Tested by: DennisD

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

channels/chan_sip.c

index 2fed49df78dba2a4784612152e532c963d9892c1..14eb0e19bdb6bbc3e567b836ba31b2ab59c3decf 100644 (file)
@@ -24004,13 +24004,6 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
                                        peer->addr.sin_port = 0;
                                        peer->host_dynamic = FALSE;
                                        srvlookup = v->value;
-                                       if (global_dynamic_exclude_static) {
-                                               int err = 0;
-                                               global_contact_ha = ast_append_ha("deny", (char *)ast_inet_ntoa(peer->addr.sin_addr), global_contact_ha, &err);
-                                               if (err) {
-                                                       ast_log(LOG_ERROR, "Bad ACL entry in configuration line %d : %s\n", v->lineno, v->value);
-                                               }
-                                       }
                                }
                        } else if (!strcasecmp(v->name, "defaultip")) {
                                if (!ast_strlen_zero(v->value) && ast_get_ip(&peer->defaddr, v->value)) {
@@ -24316,6 +24309,13 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
                }
 
                ast_string_field_set(peer, tohost, srvlookup);
+               if (global_dynamic_exclude_static) {
+                       int err = 0;
+                       global_contact_ha = ast_append_ha("deny", (char *)ast_inet_ntoa(peer->addr.sin_addr), global_contact_ha, &err);
+                       if (err) {
+                               ast_log(LOG_ERROR, "Bad ACL entry in configuration line %d : %s\n", v->lineno, v->value);
+                       }
+               }
        }
 
        if (!peer->addr.sin_port) {