Welcome! Log In Create A New Profile

Advanced

[nginx] Resolver: limited CNAME recursion.

Maxim Dounin
January 26, 2016 11:36AM
details: http://hg.nginx.org/nginx/rev/93d70d87914c
branches: stable-1.8
changeset: 6360:93d70d87914c
user: Ruslan Ermilov <ru@nginx.com>
date: Tue Jan 26 16:47:14 2016 +0300
description:
Resolver: limited CNAME recursion.

Previously, the recursion was only limited for cached responses.

diffstat:

src/core/ngx_resolver.c | 40 ++++++++++++++++++++++++++++------------
1 files changed, 28 insertions(+), 12 deletions(-)

diffs (56 lines):

diff --git a/src/core/ngx_resolver.c b/src/core/ngx_resolver.c
--- a/src/core/ngx_resolver.c
+++ b/src/core/ngx_resolver.c
@@ -1981,24 +1981,40 @@ ngx_resolver_process_a(ngx_resolver_t *r

ngx_queue_insert_head(&r->name_expire_queue, &rn->queue);

- ctx = rn->waiting;
- rn->waiting = NULL;
-
- if (ctx) {
-
- for (next = ctx; next; next = next->next) {
- next->node = NULL;
- }
-
- (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

+ 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;
+ }
+
+ (void) ngx_resolve_name_locked(r, ctx, &name);
+ }
+
/* unlock name mutex */

return;

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Resolver: limited CNAME recursion.

Maxim Dounin 247 January 26, 2016 11:36AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 138
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready