-/* $OpenBSD: resolver.c,v 1.159 2023/04/18 09:57:08 florian Exp $ */
+/* $OpenBSD: resolver.c,v 1.160 2023/04/18 09:57:51 florian Exp $ */
/*
running_res = --rq->running;
+ if (rcode == LDNS_RCODE_SERVFAIL) {
+ if (res->stop != 1)
+ check_resolver(res);
+ goto servfail;
+ }
+
if (answer_len < LDNS_HEADER_SIZE) {
log_warnx("bad packet: too short");
goto servfail;
}
answer_header->answer_len = answer_len;
- if (rcode == LDNS_RCODE_SERVFAIL) {
- if (res->stop != 1)
- check_resolver(res);
- goto servfail;
- }
-
if ((result = calloc(1, sizeof(*result))) == NULL)
goto servfail;
if ((buf = sldns_buffer_new(answer_len)) == NULL)
prev_state = checked_resolver->state;
- if (answer_len < LDNS_HEADER_SIZE) {
- checked_resolver->state = DEAD;
- log_warnx("%s: bad packet: too short", __func__);
- goto out;
- }
-
if (rcode == LDNS_RCODE_SERVFAIL) {
log_debug("%s: %s rcode: SERVFAIL", __func__,
uw_resolver_type_str[checked_resolver->type]);
goto out;
}
+ if (answer_len < LDNS_HEADER_SIZE) {
+ checked_resolver->state = DEAD;
+ log_warnx("%s: bad packet: too short", __func__);
+ goto out;
+ }
+
if (sec == SECURE) {
if (dns64_present && (res->type == UW_RES_AUTOCONF ||
res->type == UW_RES_ODOT_AUTOCONF)) {
uint16_t dnskey_flags;
char rdata_buf[1024], *ta;
+ if (rcode == LDNS_RCODE_SERVFAIL) {
+ log_debug("%s: rcode: SERVFAIL", __func__);
+ goto out;
+ }
+
if (answer_len < LDNS_HEADER_SIZE) {
log_warnx("bad packet: too short");
goto out;