Welcome! Log In Create A New Profile

Advanced

[nginx] Resolver: report SRV resolve failure if all A resolves failed.

Roman Arutyunyan
December 12, 2018 09:48AM
details: https://hg.nginx.org/nginx/rev/cbc5dee8d5d2
branches:
changeset: 7428:cbc5dee8d5d2
user: Roman Arutyunyan <arut@nginx.com>
date: Tue Dec 11 19:41:22 2018 +0300
description:
Resolver: report SRV resolve failure if all A resolves failed.

Previously, if an SRV record was successfully resolved, but all of its A
records failed to resolve, NXDOMAIN was returned to the caller, which is
considered a successful resolve rather than an error. This could result in
losing the result of a previous successful resolve by the caller.

Now NXDOMAIN is only returned if at least one A resolve completed with this
code. Otherwise the error state of the first A resolve is returned.

diffstat:

src/core/ngx_resolver.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)

diffs (20 lines):

diff -r 81d49f85afed -r cbc5dee8d5d2 src/core/ngx_resolver.c
--- a/src/core/ngx_resolver.c Tue Dec 11 13:09:00 2018 +0300
+++ b/src/core/ngx_resolver.c Tue Dec 11 19:41:22 2018 +0300
@@ -4266,7 +4266,15 @@ ngx_resolver_report_srv(ngx_resolver_t *
}

if (naddrs == 0) {
- ctx->state = NGX_RESOLVE_NXDOMAIN;
+ ctx->state = srvs[0].state;
+
+ for (i = 0; i < nsrvs; i++) {
+ if (srvs[i].state == NGX_RESOLVE_NXDOMAIN) {
+ ctx->state = NGX_RESOLVE_NXDOMAIN;
+ break;
+ }
+ }
+
ctx->valid = ngx_time() + (r->valid ? r->valid : 10);

ctx->handler(ctx);
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Resolver: report SRV resolve failure if all A resolves failed.

Roman Arutyunyan 172 December 12, 2018 09:48AM



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

Online Users

Guests: 88
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready