blob: a3ab8e11ba8435872285f6b67ed7f38056ca61f8 [file] [log] [blame]
Lorenzo Colitti84485a42018-12-18 19:16:12 +09001cc_library_headers {
2 name: "libnetd_resolv_headers",
3 export_include_dirs: ["include"],
4}
5
Bernie Innocenti86890c92020-01-08 21:00:39 +09006// Used only by dns_responder_client_ndk.cpp for ResolverStats.h
7// TODO: refactor stats to use a Parcel and eliminate this dependency
chenbruce2e2446c2019-06-28 16:37:36 +08008cc_library_headers {
9 name: "libnetd_resolv_internal_headers",
10 export_include_dirs: ["."],
11}
12
Luke Huang403c0442019-02-25 15:33:42 +080013aidl_interface {
14 name: "dnsresolver_aidl_interface",
15 local_include_dir: "binder",
16 srcs: [
17 "binder/android/net/IDnsResolver.aidl",
chenbrucefd837fa2019-10-29 18:35:36 +080018 "binder/android/net/ResolverHostsParcel.aidl",
Ken Chen99344882020-01-01 14:59:38 +080019 "binder/android/net/ResolverExperimentalOptionsParcel.aidl",
waynema37255182019-03-18 13:22:56 +080020 "binder/android/net/ResolverParamsParcel.aidl",
Luke Huang403c0442019-02-25 15:33:42 +080021 ],
Hungming Chena32c8c12019-01-25 10:47:40 +080022 imports: [
23 "netd_event_listener_interface",
24 ],
Luke Huang598daad2019-05-02 18:10:15 +080025 backend: {
26 ndk: {
27 gen_log: true,
28 },
29 },
Luke Huang5aa6a992019-04-29 22:02:11 +080030 versions: [
31 "1",
32 "2",
Luke Huang0fc985f2019-11-14 19:18:14 +080033 "3",
Luke Huang5aa6a992019-04-29 22:02:11 +080034 ],
Luke Huang403c0442019-02-25 15:33:42 +080035}
36
Luke Huang45b761c2020-03-20 22:30:43 +080037cc_defaults {
38 name: "resolv_test_defaults",
39 // Note that, static link liblog and libbase is a hard requirement for resolv related tests
40 // because libbase is not compatible between Q and R for general platform build due
41 // to its log revelant functions changing. And most of resolv related tests must be able to run
42 // in Q.
43 static_libs: [
44 "libbase",
45 "liblog",
46 ],
47}
48
Lorenzo Colitti8505af42018-12-19 20:30:41 +090049cc_library {
Bernie Innocentiafaacf72018-08-30 07:34:37 +090050 name: "libnetd_resolv",
Bernie Innocenti1e886742018-10-25 18:41:47 +090051 version_script: "libnetd_resolv.map.txt",
Jooyung Han41fa73d2019-11-27 15:41:44 +090052 stubs: {
53 versions: [
54 "1",
55 ],
56 symbol_file: "libnetd_resolv.map.txt",
57 },
Bernie Innocentiafaacf72018-08-30 07:34:37 +090058 defaults: ["netd_defaults"],
59 srcs: [
Bernie Innocenti9c575932018-09-07 21:10:25 +090060 "getaddrinfo.cpp",
61 "gethnamaddr.cpp",
62 "sethostent.cpp",
63 "res_cache.cpp",
64 "res_comp.cpp",
Bernie Innocenti9c575932018-09-07 21:10:25 +090065 "res_debug.cpp",
66 "res_init.cpp",
67 "res_mkquery.cpp",
68 "res_query.cpp",
69 "res_send.cpp",
Bernie Innocenti9c575932018-09-07 21:10:25 +090070 "res_stats.cpp",
Mike Yu021c3e12019-10-08 17:29:34 +080071 "util.cpp",
Luke Huang7b26b202019-03-28 14:09:24 +080072 "Dns64Configuration.cpp",
Mike Yu19108d52018-11-15 21:58:19 +080073 "DnsProxyListener.cpp",
Mike Yu939e3692019-10-29 17:28:34 +080074 "DnsQueryLog.cpp",
Luke Huang36796f32019-03-13 02:54:45 +080075 "DnsResolver.cpp",
Luke Huang403c0442019-02-25 15:33:42 +080076 "DnsResolverService.cpp",
Mike Yue655b1d2019-08-28 17:49:59 +080077 "DnsStats.cpp",
Mike Yubab3daa2018-10-19 22:11:43 +080078 "DnsTlsDispatcher.cpp",
79 "DnsTlsQueryMap.cpp",
80 "DnsTlsTransport.cpp",
81 "DnsTlsServer.cpp",
82 "DnsTlsSessionCache.cpp",
83 "DnsTlsSocket.cpp",
Mike Yub601ff72018-11-01 20:07:00 +080084 "PrivateDnsConfiguration.cpp",
Luke Huang7b26b202019-03-28 14:09:24 +080085 "ResolverController.cpp",
Mike Yu39cc6892018-12-14 16:18:27 +080086 "ResolverEventReporter.cpp",
Bernie Innocentiafaacf72018-08-30 07:34:37 +090087 ],
Tobias Thierer469b6332019-08-28 20:25:33 +010088 // Link most things statically to minimize our dependence on system ABIs.
Bernie Innocenti2a9244c2018-09-13 16:12:56 +090089 stl: "libc++_static",
Bernie Innocenti9f05f5e2018-09-12 23:20:10 +090090 static_libs: [
Jeongik Cha9af2c7e2019-10-15 17:06:40 +090091 "dnsresolver_aidl_interface-unstable-ndk_platform",
Bernie Innocenti9f05f5e2018-09-12 23:20:10 +090092 "libbase",
Mike Yu19108d52018-11-15 21:58:19 +080093 "libcutils",
Luke Huang598daad2019-05-02 18:10:15 +080094 "libjsoncpp",
Mike Yubab3daa2018-10-19 22:11:43 +080095 "libnetdutils",
Bernie Innocenti83a968f2019-06-27 14:35:53 +090096 "libprotobuf-cpp-lite",
lifr9b87e362019-05-08 13:00:14 +080097 "libstatslog_resolv",
Muhammad Qureshi10b3d272019-12-03 15:25:19 -080098 "libstatspush_compat",
Mike Yu19108d52018-11-15 21:58:19 +080099 "libsysutils",
Luke Huang0fc985f2019-11-14 19:18:14 +0800100 "libutils", // Used by libstatslog_resolv
Jeongik Cha9af2c7e2019-10-15 17:06:40 +0900101 "netd_event_listener_interface-ndk_platform",
waynemaa74195e2019-01-18 14:02:31 +0800102 "server_configurable_flags",
lifr9b87e362019-05-08 13:00:14 +0800103 "stats_proto",
Mike Yu39cc6892018-12-14 16:18:27 +0800104 ],
Tobias Thierer469b6332019-08-28 20:25:33 +0100105 // libcrypto needs to be used as a shared library because it performs an
106 // integrity check (against a checksum) that is not supported for static
107 // libs. See http://b/141248879
108 // We're also adding libssl here to treat it consistently.
Jiyong Parkdd938dd2020-03-09 14:35:37 +0900109 // liblog is added as a shared library because it provides stable C API
110 // from the platform; we don't need to include it in this module by
111 // statically linking to it. Doing so is even dangerous because the socket
112 // protocol to logd implemented in the library isn't guaranteed to be
113 // stable. See b/151051671
Mike Yu39cc6892018-12-14 16:18:27 +0800114 shared_libs: [
115 "libbinder_ndk",
Tobias Thierer469b6332019-08-28 20:25:33 +0100116 "libcrypto",
Jiyong Parkdd938dd2020-03-09 14:35:37 +0900117 "liblog", //Used by libstatslog_resolv
Tobias Thierer469b6332019-08-28 20:25:33 +0100118 "libssl",
Mike Yu19108d52018-11-15 21:58:19 +0800119 ],
Luke Huangf4c98f22019-06-14 01:57:00 +0800120 header_libs: [
121 "libnetd_client_headers",
Mike Yubab3daa2018-10-19 22:11:43 +0800122 ],
Ruchir Rastogicf96e8b2020-02-26 10:36:18 -0800123 runtime_libs: [
124 // Causes the linkerconfig to create a namespace link from resolv to the
125 // libstatssocket library within the statsd apex
126 "libstatssocket",
127 ],
Bernie Innocentiac18b122018-10-01 23:10:18 +0900128 export_include_dirs: ["include"],
chenbruce99cbfd82019-09-05 15:08:13 +0800129
Bernie Innocenti9f05f5e2018-09-12 23:20:10 +0900130 product_variables: {
131 debuggable: {
132 cppflags: [
133 "-DRESOLV_ALLOW_VERBOSE_LOGGING=1",
waynema0e73c2e2019-07-31 15:04:08 +0800134 "-DRESOLV_INJECT_CA_CERTIFICATE=1",
Bernie Innocenti9f05f5e2018-09-12 23:20:10 +0900135 ],
136 },
137 },
Ken Chen4961dfe2019-11-15 09:03:29 +0800138 header_abi_checker: {
139 enabled: true,
140 symbol_file: "libnetd_resolv.map.txt",
141 },
Ken Chenf5573fd2020-01-14 01:51:05 +0800142 sanitize: {
143 cfi: true,
Ken Chenf5573fd2020-01-14 01:51:05 +0800144 },
Bernie Innocentiafaacf72018-08-30 07:34:37 +0900145}
Mike Yuc52739e2018-10-19 21:06:32 +0800146
lifr9b87e362019-05-08 13:00:14 +0800147cc_library_static {
148 name: "stats_proto",
149 defaults: ["netd_defaults"],
150 proto: {
151 export_proto_headers: true,
152 type: "lite",
153 },
154 srcs: [
155 "stats.proto",
156 ],
157}
158
159genrule {
160 name: "statslog_resolv.h",
161 tools: ["stats-log-api-gen"],
162 cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_resolv.h --module resolv --namespace android,net,stats",
163 out: [
164 "statslog_resolv.h",
165 ],
166}
167
168genrule {
169 name: "statslog_resolv.cpp",
170 tools: ["stats-log-api-gen"],
Muhammad Qureshi10b3d272019-12-03 15:25:19 -0800171 cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_resolv.cpp --module resolv --namespace android,net,stats --importHeader statslog_resolv.h --supportQ",
lifr9b87e362019-05-08 13:00:14 +0800172 out: [
173 "statslog_resolv.cpp",
174 ],
175}
176
177cc_library_static {
178 name: "libstatslog_resolv",
179 generated_sources: ["statslog_resolv.cpp"],
180 generated_headers: ["statslog_resolv.h"],
181 defaults: ["netd_defaults"],
182 export_generated_headers: ["statslog_resolv.h"],
183 static_libs: [
184 "libcutils",
Muhammad Qureshi10b3d272019-12-03 15:25:19 -0800185 "libgtest_prod", // Used by libstatspush_compat
186 "libstatspush_compat",
lifr9b87e362019-05-08 13:00:14 +0800187 ],
188}
189
Luke Huangf8215372019-11-22 11:53:41 +0800190// TODO: Move this test to tests/
Ken Chenb9fa2062018-11-13 21:51:13 +0800191cc_test {
192 name: "resolv_unit_test",
Bernie Innocenticac27842019-12-13 11:49:33 +0900193 test_suites: ["device-tests", "mts"],
chenbruce609db9d2019-06-26 23:30:33 +0800194 require_root: true,
195 //TODO: drop root privileges and make it be an real unit test.
Luke Huang45b761c2020-03-20 22:30:43 +0800196 defaults: ["netd_defaults", "resolv_test_defaults"],
Mike Yuc52739e2018-10-19 21:06:32 +0800197 srcs: [
waynemae9302592019-08-15 14:50:58 +0800198 "resolv_cache_unit_test.cpp",
chenbruce98f19c22019-11-20 14:58:20 +0800199 "resolv_callback_unit_test.cpp",
waynemae9302592019-08-15 14:50:58 +0800200 "resolv_tls_unit_test.cpp",
201 "resolv_unit_test.cpp",
Mike Yue655b1d2019-08-28 17:49:59 +0800202 "DnsStatsTest.cpp",
Mike Yu39df0b12019-10-31 16:12:23 +0800203 "DnsQueryLogTest.cpp",
Mike Yuc52739e2018-10-19 21:06:32 +0800204 ],
Mike Yuc52739e2018-10-19 21:06:32 +0800205 shared_libs: [
Mike Yub601ff72018-11-01 20:07:00 +0800206 "libcrypto",
Sehee Parkd975bf32019-08-07 13:21:16 +0900207 "libbinder_ndk",
Luke Huang0b564a22020-03-19 11:33:59 +0800208 "libssl",
Mike Yuc52739e2018-10-19 21:06:32 +0800209 ],
nuccachen0efcc802018-11-28 18:19:39 +0800210 static_libs: [
chenbrucefd837fa2019-10-29 18:35:36 +0800211 "dnsresolver_aidl_interface-unstable-ndk_platform",
Jeongik Cha9af2c7e2019-10-15 17:06:40 +0900212 "netd_event_listener_interface-ndk_platform",
Luke Huang0b564a22020-03-19 11:33:59 +0800213 "libcutils",
Luke Huange126fbe2019-07-20 17:36:30 +0800214 "libgmock",
Lorenzo Colitti8505af42018-12-19 20:30:41 +0900215 "libnetd_resolv",
nuccachen0efcc802018-11-28 18:19:39 +0800216 "libnetd_test_dnsresponder",
Hungming Chend52f6b12019-07-24 16:01:47 +0800217 "libnetd_test_resolv_utils",
Lorenzo Colittidae66672018-12-19 21:13:03 +0900218 "libnetdutils",
lifr94981782019-05-17 21:15:19 +0800219 "libprotobuf-cpp-lite",
chenbruce98f19c22019-11-20 14:58:20 +0800220 "libstatslog_resolv",
Muhammad Qureshi2361d132020-01-19 07:06:45 -0800221 "libstatspush_compat",
chenbruce98f19c22019-11-20 14:58:20 +0800222 "libsysutils",
223 "libutils",
Luke Huang977e46e2019-07-04 15:33:07 +0800224 "resolv_stats_test_utils",
waynemaa74195e2019-01-18 14:02:31 +0800225 "server_configurable_flags",
lifr94981782019-05-17 21:15:19 +0800226 "stats_proto",
nuccachen0efcc802018-11-28 18:19:39 +0800227 ],
easoncylee6e47d112020-03-12 23:24:06 +0800228 compile_multilib: "first",
Mike Yuc52739e2018-10-19 21:06:32 +0800229}