summaryrefslogtreecommitdiff
path: root/resolv/ResolverController.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Move system/netd/resolv/ to packages/modules/DnsResolver.Xin Li2019-07-261-370/+0
| | | | | Bug: 134997188 Change-Id: I995135fc95177830c3e4bc46e06aadefe0a1aa55
* Restore the PrivateDnsMode emun to its original definitionlifr2019-07-251-2/+0
|\ | | | | | | | | | | am: 72e88a79af Change-Id: I74c7b4145d1469010d3e205183012a9b830f0a55
| * Restore the PrivateDnsMode emun to its original definitionlifr2019-07-261-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Westworld requires the first field of all enums to be set to UNKNOWN/UNSET, but this is awkward for the resolver code and makes it hard to verify whether we have any PrivateDnsMode variables initialized to UNKNOWN by accident. So revert this change, and add a simple function to convert the internal PrivateDnsMode enum to the other PrivateDnsMode emun defined in the stats proto. Bug: 119862317 Test: atest Change-Id: Id146a16e41e0183867b3a4e2d87a2b0fc09df27d
| * Subsampling DNS events to reduce logsLuke Huang2019-07-261-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, each device generates about 4000 queries per day. Reduce the number of events by subsampling events based on how interesting they are: - if return_code == 0 -> log 1 in 100 events (random sampling) - if return_code == EAI_NODATA -> log 1 in 10 events (random sampling) - else -> log 100% Also allow to use experiment flag to update sub-sampling denom. Example for dumpsys dnsresolver: NetId: 100 DnsEvent subsampling map: default:1 0:100 7:10 Bug: 119862317 Test: manual test with using setprop to change subsampling map atest Merged-In: Ibbe3c653bdf45fc03b56a61e3401fad11c05a010 (cherry picked from commit 79e5185780a94db0b2356edf987239da459433f4) Change-Id: I170dda9247e94a17a7cac9e7e414d592bb4dccbf
| * Fill in each dns stats value in message NetworkDnsEventReportedFrank Li2019-07-261-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Result dump metric_id: 1111 event_metrics { data { elapsed_timestamp_nanos: 166844290056 atom { network_dns_event_reported { event_type: EVENT_GETADDRINFO return_code: RC_EAI_NO_ERROR latency_micros: 78961 hints_ai_flags: 1024 res_nsend_flags: -1 network_type: NT_UNKNOWN private_dns_modes: PDM_STRICT dns_query_events { dns_query_event { rcode: NS_R_NO_ERROR type: NS_T_A ip_version: IV_IPV4 protocol: PROTO_DOT dns_server_index: 0 latency_micros: 77843 } } } } } Bug: 119862317 Test: ./out/host/linux-x86/bin/statsd_testdrive 116 Merged-In: I07fc15388b3bbc4e8a9aaaa68470cc3d8a187b8e Merged-In: Ic06e6eb30afd62e5da08d478e68d4418949c4116 (cherry picked from commit 35ff7888951031efe52e2de940e268e0aa5395f9) Change-Id: I25eca88dd3881b666135a1dd9d0941fcb697a719
| * Move internal functions out of libnetd_resolv's public headersBernie Innocenti2019-05-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is yet another preparatory change before enableing the ABI checker. Internal functions are now declared in non-public headers paired with the source files where they are declared. A followup change could further split resolv_private.h. Bug: 133117690 Test: No functionality changes, just run atest. Change-Id: If3ba28b5c2f1e1675aca2c39f16a9451ec6110ed Merged-In: I66ab2f9856e7faa82c74a8ef3fbdeef579577c64 (cherry picked from commit 92ae6241ba58bcd143328c04a7404c2cb8b5b6f3)
| * resolv: remove resolv_delete_private_dns_for_netMike Yu2019-05-301-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | It is no longer necessary since ResolverController can directly access the instance of PrivateDnsConfiguration and call its method. Bug: 130686826 Bug: 133117690 Change-Id: I16b06d9f8d438950116696296a6d6a066eb4c08b Merged-In: I340f60ef11415c9b83aa66884fffdfae3153d1d0 (cherry picked from commit 83c038a329d850950a6c60a0ae17e424daa8a29a)
| * resolv: remove resolv_set_private_dns_for_netMike Yu2019-05-301-23/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It is no longer necessary since ResolverController can directly access the instance of PrivateDnsConfiguration and call its method. Bug: 130686826 Bug: 133117690 Test: resolv_integration_test passed Test: Switched to each private DNS mode and browsed websites Change-Id: I2470e4609b4d9c71adbccc625c6ad38835df7325 Merged-In: I944aa87c903c985d47466549c1b64034bdcaedd2 (cherry picked from commit 6d399ac17d912f057367940343214c0fe9628171)
| * Move ExternalPrivateDnsStatus away from libnetd_resolv's public headersBernie Innocenti2019-05-231-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | This is a first pass at sanitizing the public headers of libnetd_resolv by moving out things that are only used internally. The main motivation is reducing noise in ABI dumps generated for the ABI checker. It's also a nice opportunity to cut off the C wrappers that we no longer need. Bug: 133117690 Test: cd system/netd && atest Merged-In: I08689c263c4fd96363666a108ba08d768ad327df Change-Id: Id0ab90fe0f962ebaf02e1cdd740ff7c04ef02eae (cherry picked from commit 1a80be408a0a77c866ed93f7d3bb8c2060b0b317)
| * Make DNS cache lifecycle management explicitLorenzo Colitti2019-04-261-15/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Add binder call to support creating cache by netid. 2. revise call flow in res_cache.cpp, not create cache in resolv_set_nameservers_for_net(). 3. revise Log method in ResolverController.cpp Bug: 129453995 Test: built, flashed, booted system/netd/tests/runtests.sh pass Merged-In: If1cefa446c83cf9b35763a03d4076fb565c25841 (cherry picked from commit 06cea11bea6da1df3efa348060ed36f2a592e501) Change-Id: I70341f4e5604b111a9672e4eff8b34b8da41f989
| * Backwards-incompatible resolv module API change for making ↵waynema2019-04-181-39/+22
| | | | | | | | | | | | | | | | | | | | | | setResolverConfiguration take a parcelable. Test: built, flashed, booted system/netd/tests/runtests.sh pass Bug: 130788363 Change-Id: I755b7832d395ab138d5440abdcb9d86fde0a00e3 Merged-In: I699d14867b8760267a2c78e7149d555262dcb692 (cherry picked from commit f09a9c942a24f69c2cc1b462831e3b8ea9ff09e6)
* | Subsampling DNS events to reduce logsLuke Huang2019-07-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, each device generates about 4000 queries per day. Reduce the number of events by subsampling events based on how interesting they are: - if return_code == 0 -> log 1 in 100 events (random sampling) - if return_code == EAI_NODATA -> log 1 in 10 events (random sampling) - else -> log 100% Also allow to use experiment flag to update sub-sampling denom. Example for dumpsys dnsresolver: NetId: 100 DnsEvent subsampling map: default:1 0:100 7:10 Bug: 119862317 Test: manual test with using setprop to change subsampling map atest Change-Id: Ie0a433a91f629dd32b1d0787a5b45926415faab0
* | Add tests for resolv_set_nameservers_for_net in res_cache_testMike Yu2019-07-091-13/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes comprises: [1] Convert resolv_set_nameservers_for_net to C++ containers. [2] Unit tests for resolv_set_nameservers_for_net. [3] Use std::vector<std::string> to store the DNS servers in struct resolv_cache_info. [4] Cleanup for libnetd_resolv_test. Bug: 134897288 Test: cd systen/netd && atest Change-Id: I4aebd22871a4ebbed08f03391e683cabe5dc2349
* | Use std::vector to store domains of nameservers and minor changeLuke Huang2019-07-031-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Drop the old C style used to store domains. Previously, resolv is limited to use 6 search domains with total 255 length. (including zero padding) After this change, the length of each domain could exactly be at most 255. (rfc 1035) Also, invalid or duplicate domains will be dropped. 2. rename resolv_set_nameservers_for_net to resolv_set_nameservers Bug: 135506574 Test: cd system/netd && atest Change-Id: I94129ea521522c817d087332a7b467f616cc4895
* | Fill in each dns stats value in message NetworkDnsEventReportedlifr2019-06-271-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Result dump metric_id: 1111 event_metrics { data { elapsed_timestamp_nanos: 166844290056 atom { network_dns_event_reported { event_type: EVENT_GETADDRINFO return_code: RC_EAI_NO_ERROR latency_micros: 78961 hints_ai_flags: 1024 res_nsend_flags: -1 network_type: NT_UNKNOWN private_dns_modes: PDM_STRICT dns_query_events { dns_query_event { rcode: NS_R_NO_ERROR type: NS_T_A ip_version: IV_IPV4 protocol: PROTO_DOT dns_server_index: 0 latency_micros: 77843 } } } } } Bug: 119862317 Test: ./out/host/linux-x86/bin/statsd_testdrive 116 Change-Id: Ia9d2ca076cdd95df206f573531a17badb34fda62
* | Use header_libs instead of include_dirs for resolvLuke Huang2019-06-141-1/+1
| | | | | | | | | | | | | | | | | | | | include libnetd_client_headers explicitly Bug: 135235267 Test: m cd system/netd && atest Change-Id: Iaeff2072ad0dcab8e42429cc4ae21f2dc3618004
* | Move internal functions out of libnetd_resolv's public headersBernie Innocenti2019-05-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | This is yet another preparatory change before enableing the ABI checker. Internal functions are now declared in non-public headers paired with the source files where they are declared. A followup change could further split resolv_private.h. Bug: 133117690 Test: No functionality changes, just run atest. Change-Id: I66ab2f9856e7faa82c74a8ef3fbdeef579577c64
* | resolv: remove resolv_delete_private_dns_for_netMike Yu2019-05-201-3/+1
| | | | | | | | | | | | | | | | | | | | | | It is no longer necessary since ResolverController can directly access the instance of PrivateDnsConfiguration and call its method. Bug: 130686826 Test: resolv_integration_test passed Test: Re-enabled WiFi, and browsed websites Change-Id: I340f60ef11415c9b83aa66884fffdfae3153d1d0
* | resolv: remove resolv_set_private_dns_for_netMike Yu2019-05-201-23/+10
| | | | | | | | | | | | | | | | | | | | | | It is no longer necessary since ResolverController can directly access the instance of PrivateDnsConfiguration and call its method. Bug: 130686826 Test: resolv_integration_test passed Test: Switched to each private DNS mode and browsed websites Change-Id: I944aa87c903c985d47466549c1b64034bdcaedd2
* | Move ExternalPrivateDnsStatus away from libnetd_resolv's public headersBernie Innocenti2019-05-201-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | This is a first pass at sanitizing the public headers of libnetd_resolv by moving out things that are only used internally. The main motivation is reducing noise in ABI dumps generated for the ABI checker. It's also a nice opportunity to cut off the C wrappers that we no longer need. Test: cd system/netd && atest Change-Id: I08689c263c4fd96363666a108ba08d768ad327df
* | Make DNS cache lifecycle management explicitLuke Huang2019-04-251-16/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | 1. Add binder call to support creating cache by netid. 2. revise call flow in res_cache.cpp, not create cache in resolv_set_nameservers_for_net(). 3. revise Log method in ResolverController.cpp Bug: 129453995 Test: built, flashed, booted system/netd/tests/runtests.sh pass Change-Id: I31ab521027a08bce3c721b2a36418faca85853c7
* | Backwards-incompatible resolv module API change for making ↵waynema2019-04-171-39/+22
| | | | | | | | | | | | | | | | setResolverConfiguration take a parcelable. Test: built, flashed, booted system/netd/tests/runtests.sh pass Change-Id: I755b7832d395ab138d5440abdcb9d86fde0a00e3
* | Unify log tag of DNS resolverKen Chen2019-04-151-1/+1
|/ | | | | | | | | Set LOG_TAG to "resolv" on DNS resolver. Then, the log can be filtered by "adb logcat [filterspecs]", such as "adb logcat *:S resolv:*", or 'grep'. Test: resolv_integration_test pass Change-Id: Ic4f97685d487257560ec3dfe62bab0d187bf9d93
* Use IDnsResolver instead of INetd for all resolver related commandsLuke Huang2019-03-291-2/+1
| | | | | | | | | | | 1. Make DnsProxyListener get DNS64 prefix internally in libnetd_resolv 2. resolver_test uses IDnsResolver instead of INetd for resolver cmds Bug: 126141549 Test: built, flashed, booted system/netd/tests/runtests.sh pass Change-Id: Ic904a3efd42ac4011ddd94ff4344449c9e647ceb
* Migrate resolver related binder commands to libnetd_resolv binderLuke Huang2019-03-291-0/+412
In order to decrease API between libnetd_resolv and netd, migrate resolver related commands to libnetd_resolv. After migration done, netd's resolver related commands will be removed in following commits. Bug: 126141549 Test: N/A. Note that this commit will cause build break, it must be grouped with following clean-up commits. Change-Id: Id0c2e20ce6a87b5c01ae5bcb998381099889306e