Repository navigation
resolve: do not hit CNAME or DNAME entry in NODATA cache - #9836
Conversation
I don't know, fixing this at time of lookup looks odd to me too... I didn't have too much time to look into this (or test this), but I noticed that: Line 705 above, in /* But not if it has a matching CNAME/DNAME (the negative
* caching will be done on the canonical name, not on the
* alias) */
r = dns_answer_find_cname_or_dname(answer, key, NULL, NULL);
if (r < 0)
goto fail;
if (r > 0)
return 0;Perhaps a fix somewhere around there would be more appropriate? I don't know if maybe the problem is whether the code currently can't distinguish between CNAME returning NODATA (which seems to be what the opened issue is triggering) and CNAME getting resolved, but the canonical name later returning NODATA (which seems to be what systemd is currently handling...) |
|
I may not correctly understand your comments or the comment in the source you referred. But I think storing the result into NODATA cache seems not bad. But using the cache entry for different type of question is not good and causes the issue. I mean that when we call |
filbranden
left a comment
There was a problem hiding this comment.
This looks good.
I was assuming that the problem was when adding entries to the cache, but that's not the case, the code will correctly add <domain, CNAME, NODATA> to the cache, but while looking it up, this function was indeed skipping other lookups because of this entry. The patch as proposed fixes this.
I also confirmed that the CNAME negative cache is working as expected, doing two lookups for CNAME on an entry that isn't a CNAME, the second one will come from the cache.
So as far as I can tell, this works as expected. I couldn't come up with any case where this would break anything or not really work as expected.
Thanks!
Filipe
Fixes systemd#9833. (cherry picked from commit 3740146)
Fixes #9833.
Though, I am not sure this is a right way to fix the problem...