mirror of
https://github.com/nginx/nginx.git
synced 2024-12-04 22:09:01 +08:00
Resolver: fixed resend on malformed responses.
DNS request resend on malformed responses was broken in 98876ce2a7fd (1.5.8). Reported by Pramod Korathota.
This commit is contained in:
parent
79c55b2cca
commit
7e52432a05
@ -1467,7 +1467,6 @@ ngx_resolver_process_a(ngx_resolver_t *r, u_char *buf, size_t last,
|
||||
goto failed;
|
||||
}
|
||||
|
||||
rn->naddrs6 = 0;
|
||||
qident = (rn->query6[0] << 8) + rn->query6[1];
|
||||
|
||||
break;
|
||||
@ -1482,7 +1481,6 @@ ngx_resolver_process_a(ngx_resolver_t *r, u_char *buf, size_t last,
|
||||
goto failed;
|
||||
}
|
||||
|
||||
rn->naddrs = 0;
|
||||
qident = (rn->query[0] << 8) + rn->query[1];
|
||||
}
|
||||
|
||||
@ -1507,6 +1505,8 @@ ngx_resolver_process_a(ngx_resolver_t *r, u_char *buf, size_t last,
|
||||
|
||||
case NGX_RESOLVE_AAAA:
|
||||
|
||||
rn->naddrs6 = 0;
|
||||
|
||||
if (rn->naddrs == (u_short) -1) {
|
||||
goto next;
|
||||
}
|
||||
@ -1519,6 +1519,8 @@ ngx_resolver_process_a(ngx_resolver_t *r, u_char *buf, size_t last,
|
||||
|
||||
default: /* NGX_RESOLVE_A */
|
||||
|
||||
rn->naddrs = 0;
|
||||
|
||||
if (rn->naddrs6 == (u_short) -1) {
|
||||
goto next;
|
||||
}
|
||||
@ -1539,6 +1541,8 @@ ngx_resolver_process_a(ngx_resolver_t *r, u_char *buf, size_t last,
|
||||
|
||||
case NGX_RESOLVE_AAAA:
|
||||
|
||||
rn->naddrs6 = 0;
|
||||
|
||||
if (rn->naddrs == (u_short) -1) {
|
||||
rn->code = (u_char) code;
|
||||
goto next;
|
||||
@ -1548,6 +1552,8 @@ ngx_resolver_process_a(ngx_resolver_t *r, u_char *buf, size_t last,
|
||||
|
||||
default: /* NGX_RESOLVE_A */
|
||||
|
||||
rn->naddrs = 0;
|
||||
|
||||
if (rn->naddrs6 == (u_short) -1) {
|
||||
rn->code = (u_char) code;
|
||||
goto next;
|
||||
@ -1817,6 +1823,25 @@ ngx_resolver_process_a(ngx_resolver_t *r, u_char *buf, size_t last,
|
||||
}
|
||||
}
|
||||
|
||||
switch (qtype) {
|
||||
|
||||
#if (NGX_HAVE_INET6)
|
||||
case NGX_RESOLVE_AAAA:
|
||||
|
||||
if (rn->naddrs6 == (u_short) -1) {
|
||||
rn->naddrs6 = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
#endif
|
||||
|
||||
default: /* NGX_RESOLVE_A */
|
||||
|
||||
if (rn->naddrs == (u_short) -1) {
|
||||
rn->naddrs = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (rn->naddrs != (u_short) -1
|
||||
#if (NGX_HAVE_INET6)
|
||||
&& rn->naddrs6 != (u_short) -1
|
||||
|
Loading…
Reference in New Issue
Block a user