Expose DNS timeout error to netd
For resolver stats, RCODE_TIMEOUT has been used for catching DNS timeout
error. This change adds the Support for reporting NETD_RESOLV_TIMEOUT to
frameworks.
Also clean up res_data.cpp as these functions are not used.
- res_init
- res_mkquery
- res_query
- res_send
- res_search
Bug: 113916551
Test: as follows
- built and flash netd
- system/netd/tests/runtests.sh passed
- silently drop packets by iptables, the return error is correct
Change-Id: I62ba6759b519d42aef62ae5b756a3c1ae3cb00d8
diff --git a/resolv/res_mkquery.cpp b/resolv/res_mkquery.cpp
index 1f2879d..32c413f 100644
--- a/resolv/res_mkquery.cpp
+++ b/resolv/res_mkquery.cpp
@@ -89,8 +89,12 @@
// Queries will be padded to a multiple of this length when EDNS0 is active.
constexpr uint16_t kEdns0Padding = 128;
-// Defined in res_data.cpp
-extern const char* _res_opcodes[];
+extern const char* const _res_opcodes[] = {
+ "QUERY", "IQUERY", "CQUERYM", "CQUERYU", /* experimental */
+ "NOTIFY", /* experimental */
+ "UPDATE", "6", "7", "8", "9", "10",
+ "11", "12", "13", "ZONEINIT", "ZONEREF",
+};
/*
* Form all types of queries.