diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-04-11 15:05:36 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-04-11 15:05:36 +0000 |
commit | c0b547d3793bc8ef10352fb0074dffb5d790eb1d (patch) | |
tree | ad690a0cde245df033ea1d3595a012083b29ba0a | |
parent | 601fbe5d1fc31e748f591afbbffabc7303acd416 (diff) |
Fix a bug with switching between host=dynamic and using specific hosts for
peers. The code would only reset the peer's address when it is dynamic if
it was a new peer structure. Now, it will also reset the address if it was
already in the peer list, but before the reload, it was not dynamic.
(issue #9515, reported by caio1982, fixed by me)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@61426 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r-- | channels/chan_sip.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 448dc00c6..db2e4b700 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -12415,7 +12415,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, int if (peer) { /* Already in the list, remove it and it will be added back (or FREE'd) */ - found++; + found = 1; } else { peer = malloc(sizeof(*peer)); if (peer) { @@ -12514,10 +12514,9 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, int ast_log(LOG_WARNING, "You can't have a dynamic outbound proxy, you big silly head at line %d.\n", v->lineno); } else { /* They'll register with us */ - ast_set_flag(&peer->flags_page2, SIP_PAGE2_DYNAMIC); - if (!found) { - /* Initialize stuff iff we're not found, otherwise - we keep going with what we had */ + if (!found || !ast_test_flag(&peer->flags_page2, SIP_PAGE2_DYNAMIC)) { + /* Initialize stuff if this is a new peer, or if it used to be + * non-dynamic before the reload. */ memset(&peer->addr.sin_addr, 0, 4); if (peer->addr.sin_port) { /* If we've already got a port, make it the default rather than absolute */ @@ -12525,6 +12524,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, int peer->addr.sin_port = 0; } } + ast_set_flag(&peer->flags_page2, SIP_PAGE2_DYNAMIC); } } else { /* Non-dynamic. Make sure we become that way if we're not */ |