CDRIVER-2789, I observed that CNAME records could be returned by res_nsearch. I discovered this by accident when testing SRV polling but forgetting to override my DNS. Connecting to this URI:
Will attempt to do SRV and TXT lookup on _mongodb._tcp.server.mongodb.com. This gave a strange error, looking like it was applying malformed text to the URI's options. When debugging it seems that the CNAME records returned were being applied as SRV / TXT records. Even querying with dig shows that CNAME records are returned when SRV / TXT is requested:
This may be a misconfigured DNS server, but we should handle that gracefully. Let's apply the same fix of
CDRIVER-2789 to the libresolv implementation of seedlist discovery and filter out non matching records.