blob: f40b4c6f7a8ab337bd21e6f60dd168a4dbc3d865 [file] [log] [blame]
Bob Badour4114d1a2021-02-12 15:38:42 -08001package {
Aditya Choudharyf7e2afb2024-01-30 13:47:16 +00002 default_team: "trendy_team_fwk_core_networking",
Bob Badour4114d1a2021-02-12 15:38:42 -08003 // See: http://go/android-license-faq
4 // A large-scale-change added 'default_applicable_licenses' to import
5 // all of the 'license_kinds' from "system_netd_license"
6 // to get the below license kinds:
7 // SPDX-license-identifier-Apache-2.0
8 default_applicable_licenses: ["system_netd_license"],
9}
10
Lorenzo Colittic3bc5842020-04-28 16:52:21 +090011aidl_interface {
Luke Huang2ff8b342019-04-30 15:33:33 +080012 // This interface is for OEM calls to netd and vice versa that do not exist in AOSP.
13 // Those calls cannot be part of INetd.aidl and INetdUnsolicitedEventListener.aidl
14 // because those interfaces are versioned.
15 // These interfaces must never be versioned or OEMs will not be able to change them.
Luke Huang0e5e69d2019-03-06 15:42:38 +080016 name: "oemnetd_aidl_interface",
Jiyong Parkcfdd3382020-04-13 15:09:35 +090017 unstable: true,
Luke Huang0e5e69d2019-03-06 15:42:38 +080018 local_include_dir: "binder",
19 srcs: [
20 "binder/com/android/internal/net/IOemNetd.aidl",
Luke Huang2ff8b342019-04-30 15:33:33 +080021 "binder/com/android/internal/net/IOemNetdUnsolicitedEventListener.aidl",
Luke Huang0e5e69d2019-03-06 15:42:38 +080022 ],
23}
24
Lorenzo Colittic3bc5842020-04-28 16:52:21 +090025// These are used in netd_integration_test
26// TODO: fold these into a cc_library_static after converting netd/server to Android.bp
27filegroup {
28 name: "netd_integration_test_shared",
29 srcs: [
30 "NetdConstants.cpp",
31 "InterfaceController.cpp",
32 "NetlinkCommands.cpp",
Lorenzo Colittic3bc5842020-04-28 16:52:21 +090033 "SockDiag.cpp",
34 "XfrmController.cpp",
Lorenzo Colittic3bc5842020-04-28 16:52:21 +090035 ],
36}
37
Bernie Innocenti98951792018-06-26 17:13:44 +090038// Modules common to both netd and netd_unit_test
39cc_library_static {
40 name: "libnetd_server",
Ken Chenb2d88882022-04-20 15:10:31 +080041 defaults: [
42 "netd_aidl_interface_lateststable_cpp_shared",
43 "netd_defaults",
44 ],
Bernie Innocenti98951792018-06-26 17:13:44 +090045 include_dirs: [
Bernie Innocenti98951792018-06-26 17:13:44 +090046 "system/netd/include",
47 "system/netd/server/binder",
48 ],
49 srcs: [
50 "BandwidthController.cpp",
51 "Controllers.cpp",
52 "NetdConstants.cpp",
53 "FirewallController.cpp",
54 "IdletimerController.cpp",
55 "InterfaceController.cpp",
56 "IptablesRestoreController.cpp",
57 "NFLogListener.cpp",
58 "NetlinkCommands.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +090059 "NetlinkManager.cpp",
60 "RouteController.cpp",
61 "SockDiag.cpp",
62 "StrictController.cpp",
63 "TcpSocketMonitor.cpp",
64 "TetherController.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +090065 "UidRanges.cpp",
66 "WakeupController.cpp",
67 "XfrmController.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +090068 ],
69 shared_libs: [
Bernie Innocenti98951792018-06-26 17:13:44 +090070 "libbase",
71 "libbinder",
Bernie Innocenti98951792018-06-26 17:13:44 +090072 "libnetutils",
73 "libnetdutils",
74 "libpcap",
Bernie Innocenti98951792018-06-26 17:13:44 +090075 "libssl",
Elliott Hughesab683522020-08-20 15:15:45 -070076 "libsysutils",
Jeongik Cha5f72c8f2021-01-26 22:35:13 +090077 "netd_event_listener_interface-V1-cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +090078 ],
Lorenzo Colittif2bd0d72021-12-09 16:18:48 +090079 static_libs: [
80 "libip_checksum",
Patrick Rohrb791bd62022-03-29 21:18:31 +020081 "libtcutils",
Lorenzo Colittif2bd0d72021-12-09 16:18:48 +090082 ],
Bernie Innocenti98951792018-06-26 17:13:44 +090083 aidl: {
84 export_aidl_headers: true,
85 local_include_dirs: ["binder"],
86 },
87}
88
Pawan Wagh3eb3bc42023-02-27 03:44:46 +000089cc_defaults {
90 name: "netd_default_sources",
Ken Chenb2d88882022-04-20 15:10:31 +080091 defaults: [
92 "netd_aidl_interface_lateststable_cpp_shared",
93 "netd_defaults",
94 ],
Bernie Innocenti98951792018-06-26 17:13:44 +090095 include_dirs: [
Bernie Innocenti98951792018-06-26 17:13:44 +090096 "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",
Ken Chenebdeba82021-10-28 09:54:46 +0800109 "libnetd_updatable",
Jooyung Han3e64aa12019-11-27 15:36:29 +0900110 "libnetd_resolv",
Bernie Innocenti98951792018-06-26 17:13:44 +0900111 "libnetdutils",
Bernie Innocentif89b3512018-08-30 07:34:37 +0900112 "libnetutils",
Bernie Innocenti98951792018-06-26 17:13:44 +0900113 "libpcap",
Suren Baghdasaryane072a3c2019-01-16 14:36:07 -0800114 "libprocessgroup",
Bernie Innocenti98951792018-06-26 17:13:44 +0900115 "libselinux",
Bernie Innocenti98951792018-06-26 17:13:44 +0900116 "libsysutils",
Bernie Innocenti98951792018-06-26 17:13:44 +0900117 "libutils",
Remi NGUYEN VANf23c8382024-02-06 02:57:52 +0000118 "mdns_aidl_interface-V1-cpp",
Jeongik Cha5f72c8f2021-01-26 22:35:13 +0900119 "netd_event_listener_interface-V1-cpp",
Luke Huang0e5e69d2019-03-06 15:42:38 +0800120 "oemnetd_aidl_interface-cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900121 ],
122 static_libs: [
Lorenzo Colittif2bd0d72021-12-09 16:18:48 +0900123 "libip_checksum",
Bernie Innocenti98951792018-06-26 17:13:44 +0900124 "libnetd_server",
Patrick Rohrb791bd62022-03-29 21:18:31 +0200125 "libtcutils",
Bernie Innocenti98951792018-06-26 17:13:44 +0900126 ],
127 srcs: [
Bernie Innocenti98951792018-06-26 17:13:44 +0900128 "DummyNetwork.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900129 "EventReporter.cpp",
130 "FwmarkServer.cpp",
131 "LocalNetwork.cpp",
Remi NGUYEN VANf23c8382024-02-06 02:57:52 +0000132 "MDnsService.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900133 "NetdCommand.cpp",
Devin Moorec304b472022-04-08 21:42:50 +0000134 "NetdHwAidlService.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900135 "NetdHwService.cpp",
136 "NetdNativeService.cpp",
137 "NetlinkHandler.cpp",
138 "Network.cpp",
139 "NetworkController.cpp",
Luke Huang0e5e69d2019-03-06 15:42:38 +0800140 "OemNetdListener.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900141 "PhysicalNetwork.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900142 "Process.cpp",
Ken Chen4e8ef9b2021-03-17 01:57:19 +0800143 "UnreachableNetwork.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900144 "VirtualNetwork.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900145 "oem_iptables_hook.cpp",
146 ],
Pawan Wagh3eb3bc42023-02-27 03:44:46 +0000147}
148
149cc_binary {
150 name: "netd",
151 defaults: [
152 "netd_default_sources",
153 ],
154 init_rc: ["netd.rc"],
155 vintf_fragments: ["android.system.net.netd-service.xml"],
156 required: [
Maciej Żenczykowski993adf42024-02-23 20:28:02 -0800157 "mainline_tethering_platform_components",
Pawan Wagh3eb3bc42023-02-27 03:44:46 +0000158 ],
159 srcs: [
160 "main.cpp",
161 ],
Ken Chen2e413c32020-01-13 11:59:53 +0800162 sanitize: {
163 cfi: true,
Ken Chen2e413c32020-01-13 11:59:53 +0800164 },
Bernie Innocenti98951792018-06-26 17:13:44 +0900165}
166
167cc_binary {
168 name: "ndc",
Ken Chenb2d88882022-04-20 15:10:31 +0800169 defaults: [
170 "netd_aidl_interface_lateststable_cpp_shared",
171 "netd_defaults",
172 ],
Luke Huangcfd04b22019-03-18 15:53:21 +0800173 include_dirs: [
174 "system/netd/include",
175 ],
176 header_libs: [
177 "libnetd_client_headers",
178 ],
179 shared_libs: [
180 "libbase",
181 "libnetdutils",
182 "libnetutils",
183 "libcutils",
184 "liblog",
185 "libutils",
186 "libbinder",
Jeongik Cha5f72c8f2021-01-26 22:35:13 +0900187 "dnsresolver_aidl_interface-V7-cpp",
Luke Huangcfd04b22019-03-18 15:53:21 +0800188 ],
189 srcs: [
190 "ndc.cpp",
191 "UidRanges.cpp",
192 "NdcDispatcher.cpp",
193 ],
Ken Chen2e413c32020-01-13 11:59:53 +0800194 sanitize: {
195 cfi: true,
Ken Chen2e413c32020-01-13 11:59:53 +0800196 },
Bernie Innocenti98951792018-06-26 17:13:44 +0900197}
198
199cc_test {
200 name: "netd_unit_test",
Ken Chenb2d88882022-04-20 15:10:31 +0800201 defaults: [
202 "netd_aidl_interface_lateststable_cpp_static",
203 "netd_defaults",
204 ],
Bernie Innocenti98951792018-06-26 17:13:44 +0900205 test_suites: ["device-tests"],
Bernie Innocenti83a67ca2019-06-19 16:28:05 +0900206 require_root: true,
Bernie Innocenti98951792018-06-26 17:13:44 +0900207 include_dirs: [
208 "system/netd/include",
209 "system/netd/server/binder",
210 "system/netd/tests",
Bernie Innocenti98951792018-06-26 17:13:44 +0900211 ],
Chih-Hung Hsiehf1ecd6d2022-02-17 17:29:33 -0800212 tidy_timeout_srcs: [
213 "BandwidthControllerTest.cpp",
214 "InterfaceControllerTest.cpp",
215 "XfrmControllerTest.cpp",
216 ],
Bernie Innocenti98951792018-06-26 17:13:44 +0900217 srcs: [
218 "BandwidthControllerTest.cpp",
219 "ControllersTest.cpp",
220 "FirewallControllerTest.cpp",
221 "IdletimerControllerTest.cpp",
222 "InterfaceControllerTest.cpp",
223 "IptablesBaseTest.cpp",
224 "IptablesRestoreControllerTest.cpp",
225 "NFLogListenerTest.cpp",
226 "RouteControllerTest.cpp",
227 "SockDiagTest.cpp",
228 "StrictControllerTest.cpp",
229 "TetherControllerTest.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900230 "XfrmControllerTest.cpp",
231 "WakeupControllerTest.cpp",
232 ],
233 static_libs: [
234 "libgmock",
Lorenzo Colittif2bd0d72021-12-09 16:18:48 +0900235 "libip_checksum",
Bernie Innocenti98951792018-06-26 17:13:44 +0900236 "libnetd_server",
237 "libnetd_test_tun_interface",
Patrick Rohrb791bd62022-03-29 21:18:31 +0200238 "libtcutils",
Jeongik Cha5f72c8f2021-01-26 22:35:13 +0900239 "netd_event_listener_interface-V1-cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900240 ],
241 shared_libs: [
242 "libbase",
243 "libbinder",
Bernie Innocenti98951792018-06-26 17:13:44 +0900244 "libcrypto",
245 "libcutils",
246 "liblog",
Bernie Innocenti98951792018-06-26 17:13:44 +0900247 "libnetdutils",
248 "libnetutils",
Bernie Innocenti98951792018-06-26 17:13:44 +0900249 "libsysutils",
250 "libutils",
251 ],
Lorenzo Colitti10819c52020-09-17 21:32:44 +0900252 // tidy: false, // cuts test build time by almost 1 minute
Bernie Innocenti98951792018-06-26 17:13:44 +0900253}
Pawan Wagh77393442023-02-17 22:14:06 +0000254
255cc_defaults {
256 name: "netd_aidl_fuzzer_defaults",
257 defaults: [
Pawan Wagh3eb3bc42023-02-27 03:44:46 +0000258 "netd_default_sources",
Pawan Waghfba73002023-05-05 21:56:19 +0000259 "fuzzer_disable_leaks",
Pawan Wagh77393442023-02-17 22:14:06 +0000260 ],
261 srcs: [
Pawan Wagh77393442023-02-17 22:14:06 +0000262 "Controllers.cpp",
263 ],
264 fuzz_config: {
265 cc: [
266 "cken@google.com",
Pawan Wagh77393442023-02-17 22:14:06 +0000267 ],
Pawan Waghfba73002023-05-05 21:56:19 +0000268 triage_assignee: "waghpawan@google.com",
Aditya Choudharyf7e2afb2024-01-30 13:47:16 +0000269 },
Pawan Wagh77393442023-02-17 22:14:06 +0000270}
271
272cc_fuzz {
Pawan Wagh5d44be72023-02-17 22:36:23 +0000273 name: "netd_hw_service_fuzzer",
274 defaults: [
275 "service_fuzzer_defaults",
276 "netd_aidl_fuzzer_defaults",
277 ],
278 srcs: [
279 "aidl-fuzzers/NetdHwAidlServiceFuzzer.cpp",
280 ],
281}
Pawan Wagh7f3ca962023-02-17 22:57:53 +0000282
283cc_fuzz {
284 name: "netd_native_service_fuzzer",
285 defaults: [
286 "service_fuzzer_defaults",
287 "netd_aidl_fuzzer_defaults",
288 ],
289 srcs: [
290 "aidl-fuzzers/NetdNativeServiceFuzzer.cpp",
291 ],
292}