commit | 84f5fa8bca6b2bb693700a65844165cdf3a7a8ed | [log] [tgz] |
---|---|---|
author | Ken Chen <cken@google.com> | Tue Mar 29 23:48:05 2022 +0800 |
committer | Ken Chen <cken@google.com> | Fri Apr 08 02:29:50 2022 +0000 |
tree | aa273fd76c5c50c7bbc07beff5829ae04b57ce8f | |
parent | f3c4207551b096dfa148fc5fe3382f96dc970ca1 [diff] |
Remove unicast-response bit from .local resolution RFC 6762 section 6.7 says that the Multicast DNS responder MUST send a UDP response directly back to the querier, via unicast, to the query packet's source IP address and port if the source UDP port in a received Multicast DNS query is not 5353. Section 5.4 also mentions "...New questions created by local clients afterwards should be treated as normal 'QM' questions and SHOULD NOT have the unicast-response bit set on the first question of the series." DNS resolver works as a one-shot Multicast DNS querier, which send queries from random ports. The unicast-response bit is not necessary to be set. Setting the unicast-response bit may also cause malfunction on .local fallback queries. Currently, the bit is not cleared while .local resolution is fallbacked from Multicast to Unicast DNS queries. DNS server may send a no error response without Answer RR, or a failure. One way to fix this is clearing the unicast-response bit before fallback. However, it needs to parse packet bytes in res_nsend() because the query packet is made before the res_nsend() but the fallback decision is made in res_nsend(). Besides, it can cause problems in cache. The query class is counted in cache key hashing. The answer obtained by fallback queries is hashed (without unicast-response bit) and stored in cache. But subsequent .local queries cannot match the record because their unicast-response bit is initially set. To avoid adding more complexity, the unnecessary unicast-response bit should be removed. Bug: 227147672 Test: atest Test: Ping test.local on openWRT with fallback and without fallback. Change-Id: Ib703a7537f638669fdc1d9c6927800e5c901786a
This code uses LOG(X) for logging. Log levels are VERBOSE,DEBUG,INFO,WARNING and ERROR. The default setting is WARNING and logs relate to WARNING and ERROR will be shown. If you want to enable the DEBUG level logs, using following command. adb shell service call dnsresolver 10 i32 1 VERBOSE 0 DEBUG 1 INFO 2 WARNING 3 ERROR 4 Verbose resolver logs could contain PII -- do NOT enable in production builds.