Commit ab7c069
committed
Fix DNS performance: preserve TTLs and enable systemd-resolved caching
DnsQueryRaw internally bypasses the Windows DNS cache, causing all DNS
responses tunneled to WSL to carry reset TTL values. This breaks
downstream caching in systemd-resolved, leading to repeated wire queries
for every DNS lookup — including negative (NODATA) responses for
unsupported record types like AAAA on IPv4-only networks.
This commit applies two complementary fixes:
1. Add DNS_QUERY_DONT_RESET_TTL_VALUES flag to DnsQueryRaw requests
(DnsResolver.cpp) so that responses carry real decremented TTL values
from upstream resolvers instead of reset-to-original values.
2. Write a systemd-resolved drop-in config enabling Cache=yes
(init.cpp) to cache both positive and negative DNS responses. The
default Cache=no-negative discards NODATA/NXDOMAIN answers, causing
repeated wire queries for record types that will never resolve.
Together these changes restore effective DNS caching for WSL, reducing
redundant network round-trips and improving DNS resolution latency.
Fixes: #14568
Related: #9423, #134151 parent 107104e commit ab7c069
2 files changed
Lines changed: 16 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
339 | 348 | | |
340 | 349 | | |
341 | 350 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
241 | 246 | | |
242 | 247 | | |
243 | 248 | | |
| |||
253 | 258 | | |
254 | 259 | | |
255 | 260 | | |
256 | | - | |
| 261 | + | |
| 262 | + | |
257 | 263 | | |
258 | 264 | | |
259 | 265 | | |
| |||
0 commit comments