nigoroll / libvmod-dynamic

The Varnish dns/named director continued
BSD 2-Clause "Simplified" License
95 stars 34 forks source link

Add resolver fallback to the null resolver (getaddrinfo) #103

Open delthas opened 1 year ago

delthas commented 1 year ago

This enables a best-effort, two-step resolution when a resolver is configured:


The patch is somewhat dumb, it just wraps the resolve logic in a loop that can iterate twice. The goal was to minimize the size of git diff -w.

This causes the module to log Lookup & Results & Error twice in case we do the fallback attempt, which could be a nice side-effect (we can investigate a DNS error in varnishlog but see that it still succeeded). I don't have a strong opinion about this one.

Feel free to amend and merge if you'd like. Otherwise I can make changes. :smile:

nigoroll commented 1 year ago

Thank you for your work on this!

Regarding the implementation, I would actually like to see if we can avoid the additional while block. As you already said you'd be fine with amending, I would just do that.

But, more importantly:

nigoroll commented 7 months ago

Hi @delthas, are you still interested in this patch? If yes, I would be interested in your opinion about my two questions:

  • Shouldn't we make the fallback optional? I fear there might be cases where /etc/hosts in particular should not be used.

    • Or should we even go one step further and support a list of resolvers to try?