• Witold Krecicki's avatar
    If possible don't use forwarders when priming the resolver. · b49310ac
    Witold Krecicki authored
    If we try to fetch a record from cache and need to look into
    hints database we assume that the resolver is not primed and
    start dns_resolver_prime(). Priming query is supposed to return
    NSes for "." in ANSWER section and glue records for them in
    ADDITIONAL section, so that we can fill that info in 'regular'
    cache and not use hints db anymore.
    However, if we're using a forwarder the priming query goes through
    it, and if it's configured to return minimal answers we won't get
    the addresses of root servers in ADDITIONAL section. Since the
    only records for root servers we have are in hints database we'll
    try to prime the resolver with every single query.
    
    This patch adds a DNS_FETCHOPT_NOFORWARD flag which avoids using
    forwarders if possible (that is if we have forward-first policy).
    Using this flag on priming fetch fixes the problem as we get the
    proper glue. With forward-only policy the problem is non-existent,
    as we'll never ask for root server addresses because we'll never
    have a need to query them.
    
    Also added a test to confirm priming queries are not forwarded.
    b49310ac
resolver.h 19.6 KB