uint8_t addr_prefixes[NO6_PREFIX_COUNT][NO6_PREFIX_BYTES];
} no6_est = { .len_used = 0 };
-static inline bool no6_is_bad(void)
+bool no6_is_bad(void)
{
return no6_est.len_used == NO6_PREFIX_COUNT;
}
/* "EXPLOIT":
* choose a resolved address which seems best right now. */
chosen = best;
- if (no6_is_bad())
- VERBOSE_MSG(NULL, "NO6: is KO [exploit]\n");
}
/* Don't try the same server again when there are other choices to be explored */
*/
void update_address_state(struct address_state *state, union kr_sockaddr *address,
size_t address_len, struct kr_query *qry);
+
+/** @internal Return whether IPv6 is considered to be broken. */
+bool no6_is_bad(void);
+
// Filter valid addresses and names from the tries
int choices_len = get_valid_addresses(local_state, choices);
int resolvable_len = get_resolvable_names(local_state, resolvable, qry);
+ bool * const force_resolve_p = &qry->server_selection.local_state->force_resolve;
+
+ // Print some stats into debug logs.
+ if (kr_log_is_debug_qry(SELECTION, qry)) {
+ int v4_choices = 0;
+ for (int i = 0; i < choices_len; ++i)
+ if (choices[i].address.ip.sa_family == AF_INET)
+ ++v4_choices;
+ int v4_resolvable = 0;
+ for (int i = 0; i < resolvable_len; ++i)
+ if (resolvable[i].type == KR_TRANSPORT_RESOLVE_A)
+ ++v4_resolvable;
+ VERBOSE_MSG(qry, "=> id: '%05u' choosing from addresses: %d v4 + %d v6; "
+ "names to resolve: %d v4 + %d v6; "
+ "force_resolve: %d; NO6: IPv6 is %s\n",
+ qry->id, v4_choices, choices_len - v4_choices,
+ v4_resolvable, resolvable_len - v4_resolvable,
+ (int)*force_resolve_p, no6_is_bad() ? "KO" : "OK");
+ }
- if (qry->server_selection.local_state->force_resolve && resolvable_len) {
+ if (*force_resolve_p && resolvable_len) {
choices_len = 0;
- qry->server_selection.local_state->force_resolve = false;
+ *force_resolve_p = false;
}
bool tcp = qry->flags.TCP || qry->server_selection.local_state->truncated;