Resolver: limited CNAME recursion.

Previously, the recursion was only limited for cached responses.
This commit is contained in:
Ruslan Ermilov 2016-01-26 16:47:14 +03:00
parent 8e2ba53330
commit fa8de0e110
1 changed files with 22 additions and 6 deletions

View File

@ -1981,11 +1981,33 @@ ngx_resolver_process_a(ngx_resolver_t *r, u_char *buf, size_t last,
ngx_queue_insert_head(&r->name_expire_queue, &rn->queue);
ngx_resolver_free(r, rn->query);
rn->query = NULL;
#if (NGX_HAVE_INET6)
rn->query6 = NULL;
#endif
ctx = rn->waiting;
rn->waiting = NULL;
if (ctx) {
if (ctx->recursion++ >= NGX_RESOLVER_MAX_RECURSION) {
/* unlock name mutex */
do {
ctx->state = NGX_RESOLVE_NXDOMAIN;
next = ctx->next;
ctx->handler(ctx);
ctx = next;
} while (ctx);
return;
}
for (next = ctx; next; next = next->next) {
next->node = NULL;
}
@ -1993,12 +2015,6 @@ ngx_resolver_process_a(ngx_resolver_t *r, u_char *buf, size_t last,
(void) ngx_resolve_name_locked(r, ctx, &name);
}
ngx_resolver_free(r, rn->query);
rn->query = NULL;
#if (NGX_HAVE_INET6)
rn->query6 = NULL;
#endif
/* unlock name mutex */
return;