Mark native DNS cache entries stale on network change instead of deleting them
Categories
(Core :: Networking: DNS, enhancement, P2)
Tracking
()
People
(Reporter: mail, Unassigned)
References
(Depends on 1 open bug)
Details
(Whiteboard: [necko-triaged])
On a network change, nsDNSService calls nsHostResolver::FlushCache(false), which deletes every resolved native A/AAAA record (FlushCache, RemoveOrRefresh). The next lookup for each of these hosts then waits for a fresh resolution.
Happy Eyeballs already handles stale answers: it races connections on a stale answer right away and revalidates it with a second query that forbids stale answers (happy-eyeballs/src/lib.rs, #L1485-L1505). This is Optimistic DNS. If the stale address works, the connection does not wait for DNS. If it fails, the fresh answer is used.
Proposal: on network change, mark native records stale instead of deleting them.
This feature needs to be gated on Happy Eyeballs (Bug 1953459). Without Happy Eyeballs, doing this is not safe, as without, Firefox does not properly do Optimistic DNS.
Related: FlushCache keeps by-type records because "by-type records are from TRR". HTTPS records are now also resolved natively (nsHostResolver.cpp), so today native HTTPS records survive a network change while the native A/AAAA records of the same host are deleted. This change would treat both the same.
Description
•