blob: 7773cb02cb058c97dcdf3a66d016f41833f14025 [file] [log] [blame]
Bob Badour4114d1a2021-02-12 15:38:42 -08001package {
2 // See: http://go/android-license-faq
3 // A large-scale-change added 'default_applicable_licenses' to import
4 // all of the 'license_kinds' from "system_netd_license"
5 // to get the below license kinds:
6 // SPDX-license-identifier-Apache-2.0
7 default_applicable_licenses: ["system_netd_license"],
8}
9
Lorenzo Colittic3bc5842020-04-28 16:52:21 +090010aidl_interface {
Luke Huang2ff8b342019-04-30 15:33:33 +080011 // This interface is for OEM calls to netd and vice versa that do not exist in AOSP.
12 // Those calls cannot be part of INetd.aidl and INetdUnsolicitedEventListener.aidl
13 // because those interfaces are versioned.
14 // These interfaces must never be versioned or OEMs will not be able to change them.
Luke Huang0e5e69d2019-03-06 15:42:38 +080015 name: "oemnetd_aidl_interface",
Jiyong Parkcfdd3382020-04-13 15:09:35 +090016 unstable: true,
Luke Huang0e5e69d2019-03-06 15:42:38 +080017 local_include_dir: "binder",
18 srcs: [
19 "binder/com/android/internal/net/IOemNetd.aidl",
Luke Huang2ff8b342019-04-30 15:33:33 +080020 "binder/com/android/internal/net/IOemNetdUnsolicitedEventListener.aidl",
Luke Huang0e5e69d2019-03-06 15:42:38 +080021 ],
22}
23
Lorenzo Colittic3bc5842020-04-28 16:52:21 +090024// These are used in netd_integration_test
25// TODO: fold these into a cc_library_static after converting netd/server to Android.bp
26filegroup {
27 name: "netd_integration_test_shared",
28 srcs: [
29 "NetdConstants.cpp",
30 "InterfaceController.cpp",
31 "NetlinkCommands.cpp",
Lorenzo Colittic3bc5842020-04-28 16:52:21 +090032 "SockDiag.cpp",
33 "XfrmController.cpp",
Lorenzo Colittic3bc5842020-04-28 16:52:21 +090034 ],
35}
36
Bernie Innocenti98951792018-06-26 17:13:44 +090037// Modules common to both netd and netd_unit_test
38cc_library_static {
39 name: "libnetd_server",
Ken Chenb2d88882022-04-20 15:10:31 +080040 defaults: [
41 "netd_aidl_interface_lateststable_cpp_shared",
42 "netd_defaults",
43 ],
Bernie Innocenti98951792018-06-26 17:13:44 +090044 include_dirs: [
Bernie Innocenti98951792018-06-26 17:13:44 +090045 "system/netd/include",
46 "system/netd/server/binder",
47 ],
48 srcs: [
49 "BandwidthController.cpp",
50 "Controllers.cpp",
51 "NetdConstants.cpp",
52 "FirewallController.cpp",
53 "IdletimerController.cpp",
54 "InterfaceController.cpp",
55 "IptablesRestoreController.cpp",
56 "NFLogListener.cpp",
57 "NetlinkCommands.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +090058 "NetlinkManager.cpp",
59 "RouteController.cpp",
60 "SockDiag.cpp",
61 "StrictController.cpp",
62 "TcpSocketMonitor.cpp",
63 "TetherController.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +090064 "UidRanges.cpp",
65 "WakeupController.cpp",
66 "XfrmController.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +090067 ],
68 shared_libs: [
Bernie Innocenti98951792018-06-26 17:13:44 +090069 "libbase",
70 "libbinder",
Bernie Innocenti98951792018-06-26 17:13:44 +090071 "libnetutils",
72 "libnetdutils",
73 "libpcap",
Bernie Innocenti98951792018-06-26 17:13:44 +090074 "libssl",
Elliott Hughesab683522020-08-20 15:15:45 -070075 "libsysutils",
Jeongik Cha5f72c8f2021-01-26 22:35:13 +090076 "netd_event_listener_interface-V1-cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +090077 ],
Lorenzo Colittif2bd0d72021-12-09 16:18:48 +090078 static_libs: [
79 "libip_checksum",
Patrick Rohrb791bd62022-03-29 21:18:31 +020080 "libtcutils",
Lorenzo Colittif2bd0d72021-12-09 16:18:48 +090081 ],
Bernie Innocenti98951792018-06-26 17:13:44 +090082 aidl: {
83 export_aidl_headers: true,
84 local_include_dirs: ["binder"],
85 },
86}
87
Pawan Wagh3eb3bc42023-02-27 03:44:46 +000088cc_defaults {
89 name: "netd_default_sources",
Ken Chenb2d88882022-04-20 15:10:31 +080090 defaults: [
91 "netd_aidl_interface_lateststable_cpp_shared",
92 "netd_defaults",
93 ],
Bernie Innocenti98951792018-06-26 17:13:44 +090094 include_dirs: [
Bernie Innocenti98951792018-06-26 17:13:44 +090095 "external/mdnsresponder/mDNSShared",
96 "system/netd/include",
97 ],
Bernie Innocenti98951792018-06-26 17:13:44 +090098 shared_libs: [
99 "android.system.net.netd@1.0",
100 "android.system.net.netd@1.1",
Devin Moorec304b472022-04-08 21:42:50 +0000101 "android.system.net.netd-V1-ndk",
Bernie Innocentif89b3512018-08-30 07:34:37 +0900102 "libbase",
Bernie Innocenti98951792018-06-26 17:13:44 +0900103 "libbinder",
Devin Moorec304b472022-04-08 21:42:50 +0000104 "libbinder_ndk",
Bernie Innocenti98951792018-06-26 17:13:44 +0900105 "libcutils",
106 "libdl",
107 "libhidlbase",
Bernie Innocenti98951792018-06-26 17:13:44 +0900108 "liblog",
Bernie Innocenti98951792018-06-26 17:13:44 +0900109 "libmdnssd",
Ken Chenebdeba82021-10-28 09:54:46 +0800110 "libnetd_updatable",
Jooyung Han3e64aa12019-11-27 15:36:29 +0900111 "libnetd_resolv",
Bernie Innocenti98951792018-06-26 17:13:44 +0900112 "libnetdutils",
Bernie Innocentif89b3512018-08-30 07:34:37 +0900113 "libnetutils",
Bernie Innocenti98951792018-06-26 17:13:44 +0900114 "libpcap",
Suren Baghdasaryane072a3c2019-01-16 14:36:07 -0800115 "libprocessgroup",
Bernie Innocenti98951792018-06-26 17:13:44 +0900116 "libselinux",
Bernie Innocenti98951792018-06-26 17:13:44 +0900117 "libsysutils",
Bernie Innocenti98951792018-06-26 17:13:44 +0900118 "libutils",
paulhuc8a58ff2022-02-09 18:37:27 +0800119 "mdns_aidl_interface-V1-cpp",
Jeongik Cha5f72c8f2021-01-26 22:35:13 +0900120 "netd_event_listener_interface-V1-cpp",
Luke Huang0e5e69d2019-03-06 15:42:38 +0800121 "oemnetd_aidl_interface-cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900122 ],
123 static_libs: [
Lorenzo Colittif2bd0d72021-12-09 16:18:48 +0900124 "libip_checksum",
Bernie Innocenti98951792018-06-26 17:13:44 +0900125 "libnetd_server",
Patrick Rohrb791bd62022-03-29 21:18:31 +0200126 "libtcutils",
Bernie Innocenti98951792018-06-26 17:13:44 +0900127 ],
128 srcs: [
Bernie Innocenti98951792018-06-26 17:13:44 +0900129 "DummyNetwork.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900130 "EventReporter.cpp",
131 "FwmarkServer.cpp",
132 "LocalNetwork.cpp",
paulhu72742952022-02-09 21:24:09 +0800133 "MDnsEventReporter.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900134 "MDnsSdListener.cpp",
paulhuc8a58ff2022-02-09 18:37:27 +0800135 "MDnsService.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900136 "NetdCommand.cpp",
Devin Moorec304b472022-04-08 21:42:50 +0000137 "NetdHwAidlService.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900138 "NetdHwService.cpp",
139 "NetdNativeService.cpp",
140 "NetlinkHandler.cpp",
141 "Network.cpp",
142 "NetworkController.cpp",
Luke Huang0e5e69d2019-03-06 15:42:38 +0800143 "OemNetdListener.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900144 "PhysicalNetwork.cpp",
145 "PppController.cpp",
146 "Process.cpp",
Ken Chen4e8ef9b2021-03-17 01:57:19 +0800147 "UnreachableNetwork.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900148 "VirtualNetwork.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900149 "oem_iptables_hook.cpp",
150 ],
Pawan Wagh3eb3bc42023-02-27 03:44:46 +0000151}
152
153cc_binary {
154 name: "netd",
155 defaults: [
156 "netd_default_sources",
157 ],
158 init_rc: ["netd.rc"],
159 vintf_fragments: ["android.system.net.netd-service.xml"],
160 required: [
161 "bpfloader",
162 ],
163 srcs: [
164 "main.cpp",
165 ],
Ken Chen2e413c32020-01-13 11:59:53 +0800166 sanitize: {
167 cfi: true,
Evgenii Stepanovea2f6032021-05-21 15:27:10 -0700168 memtag_heap: true,
Ken Chen2e413c32020-01-13 11:59:53 +0800169 },
Bernie Innocenti98951792018-06-26 17:13:44 +0900170}
171
172cc_binary {
173 name: "ndc",
Ken Chenb2d88882022-04-20 15:10:31 +0800174 defaults: [
175 "netd_aidl_interface_lateststable_cpp_shared",
176 "netd_defaults",
177 ],
Luke Huangcfd04b22019-03-18 15:53:21 +0800178 include_dirs: [
179 "system/netd/include",
180 ],
181 header_libs: [
182 "libnetd_client_headers",
183 ],
184 shared_libs: [
185 "libbase",
186 "libnetdutils",
187 "libnetutils",
188 "libcutils",
189 "liblog",
190 "libutils",
191 "libbinder",
Jeongik Cha5f72c8f2021-01-26 22:35:13 +0900192 "dnsresolver_aidl_interface-V7-cpp",
Luke Huangcfd04b22019-03-18 15:53:21 +0800193 ],
194 srcs: [
195 "ndc.cpp",
196 "UidRanges.cpp",
197 "NdcDispatcher.cpp",
198 ],
Ken Chen2e413c32020-01-13 11:59:53 +0800199 sanitize: {
200 cfi: true,
Evgenii Stepanovd18e38a2021-04-02 15:46:24 -0700201 memtag_heap: true,
Ken Chen2e413c32020-01-13 11:59:53 +0800202 },
Bernie Innocenti98951792018-06-26 17:13:44 +0900203}
204
205cc_test {
206 name: "netd_unit_test",
Ken Chenb2d88882022-04-20 15:10:31 +0800207 defaults: [
208 "netd_aidl_interface_lateststable_cpp_static",
209 "netd_defaults",
210 ],
Bernie Innocenti98951792018-06-26 17:13:44 +0900211 test_suites: ["device-tests"],
Bernie Innocenti83a67ca2019-06-19 16:28:05 +0900212 require_root: true,
Bernie Innocenti98951792018-06-26 17:13:44 +0900213 include_dirs: [
214 "system/netd/include",
215 "system/netd/server/binder",
216 "system/netd/tests",
Bernie Innocenti98951792018-06-26 17:13:44 +0900217 ],
Chih-Hung Hsiehf1ecd6d2022-02-17 17:29:33 -0800218 tidy_timeout_srcs: [
219 "BandwidthControllerTest.cpp",
220 "InterfaceControllerTest.cpp",
221 "XfrmControllerTest.cpp",
222 ],
Bernie Innocenti98951792018-06-26 17:13:44 +0900223 srcs: [
224 "BandwidthControllerTest.cpp",
225 "ControllersTest.cpp",
226 "FirewallControllerTest.cpp",
227 "IdletimerControllerTest.cpp",
228 "InterfaceControllerTest.cpp",
229 "IptablesBaseTest.cpp",
230 "IptablesRestoreControllerTest.cpp",
231 "NFLogListenerTest.cpp",
232 "RouteControllerTest.cpp",
233 "SockDiagTest.cpp",
234 "StrictControllerTest.cpp",
235 "TetherControllerTest.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900236 "XfrmControllerTest.cpp",
237 "WakeupControllerTest.cpp",
238 ],
239 static_libs: [
240 "libgmock",
Lorenzo Colittif2bd0d72021-12-09 16:18:48 +0900241 "libip_checksum",
Bernie Innocenti98951792018-06-26 17:13:44 +0900242 "libnetd_server",
243 "libnetd_test_tun_interface",
Patrick Rohrb791bd62022-03-29 21:18:31 +0200244 "libtcutils",
Jeongik Cha5f72c8f2021-01-26 22:35:13 +0900245 "netd_event_listener_interface-V1-cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900246 ],
247 shared_libs: [
248 "libbase",
249 "libbinder",
Bernie Innocenti98951792018-06-26 17:13:44 +0900250 "libcrypto",
251 "libcutils",
252 "liblog",
Bernie Innocenti98951792018-06-26 17:13:44 +0900253 "libnetdutils",
254 "libnetutils",
Bernie Innocenti98951792018-06-26 17:13:44 +0900255 "libsysutils",
256 "libutils",
257 ],
Lorenzo Colitti10819c52020-09-17 21:32:44 +0900258 // tidy: false, // cuts test build time by almost 1 minute
Bernie Innocenti98951792018-06-26 17:13:44 +0900259}
Pawan Wagh77393442023-02-17 22:14:06 +0000260
261cc_defaults {
262 name: "netd_aidl_fuzzer_defaults",
263 defaults: [
Pawan Wagh3eb3bc42023-02-27 03:44:46 +0000264 "netd_default_sources",
Pawan Wagh77393442023-02-17 22:14:06 +0000265 ],
266 srcs: [
Pawan Wagh77393442023-02-17 22:14:06 +0000267 "Controllers.cpp",
268 ],
269 fuzz_config: {
270 cc: [
271 "cken@google.com",
Pawan Wagh77393442023-02-17 22:14:06 +0000272 ],
273 }
274}
275
276cc_fuzz {
277 name: "mdns_service_fuzzer",
278 defaults: [
279 "service_fuzzer_defaults",
280 "netd_aidl_fuzzer_defaults",
281 ],
282 srcs: [
283 "aidl-fuzzers/MDnsServiceFuzzer.cpp",
284 ],
Pawan Wagh3eb3bc42023-02-27 03:44:46 +0000285 fuzz_config: {
286 cc: [
287 "paulhu@google.com",
288 ],
289 }
Pawan Wagh77393442023-02-17 22:14:06 +0000290}
Pawan Wagh5d44be72023-02-17 22:36:23 +0000291
292cc_fuzz {
293 name: "netd_hw_service_fuzzer",
294 defaults: [
295 "service_fuzzer_defaults",
296 "netd_aidl_fuzzer_defaults",
297 ],
298 srcs: [
299 "aidl-fuzzers/NetdHwAidlServiceFuzzer.cpp",
300 ],
301}
Pawan Wagh7f3ca962023-02-17 22:57:53 +0000302
303cc_fuzz {
304 name: "netd_native_service_fuzzer",
305 defaults: [
306 "service_fuzzer_defaults",
307 "netd_aidl_fuzzer_defaults",
308 ],
309 srcs: [
310 "aidl-fuzzers/NetdNativeServiceFuzzer.cpp",
311 ],
312}
313