blob: 0d5c5eb20c474ae499c66bcb829c6096522bccaf [file] [log] [blame]
Luke Huangcaebcbb2018-09-27 20:37:14 +08001aidl_interface {
2 name: "netd_aidl_interface",
3 local_include_dir: "binder",
4 srcs: [
Luke Huang03074eb2018-11-23 17:03:03 +08005 "binder/android/net/INetd.aidl",
Luke Huang528af602018-08-29 19:06:05 +08006 // AIDL interface that callers can implement to receive networking events from netd.
7 "binder/android/net/INetdUnsolicitedEventListener.aidl",
Luke Huang03074eb2018-11-23 17:03:03 +08008 "binder/android/net/InterfaceConfigurationParcel.aidl",
Chiachang Wang00fc62f2019-12-04 20:38:26 +08009 "binder/android/net/MarkMaskParcel.aidl",
Tyler Wearfa94a272019-12-05 15:01:48 -080010 "binder/android/net/RouteInfoParcel.aidl",
Chiachang Wang08cb2112019-12-10 09:53:24 +080011 "binder/android/net/TetherConfigParcel.aidl",
Lorenzo Colittif0e051c2020-04-06 09:19:57 +000012 "binder/android/net/TetherOffloadRuleParcel.aidl",
Luke Huangcaebcbb2018-09-27 20:37:14 +080013 "binder/android/net/TetherStatsParcel.aidl",
Luke Huang94658ac2018-10-18 19:35:12 +090014 "binder/android/net/UidRangeParcel.aidl",
Luke Huangcaebcbb2018-09-27 20:37:14 +080015 ],
Luke Huangf7782042018-08-08 13:13:04 +080016 backend: {
Xiao Ma33d562a2018-12-16 16:27:38 +090017 cpp: {
18 gen_log: true,
19 },
Luke Huang67649312020-04-01 01:17:42 +080020 java: {
Lorenzo Colittie90d5c42020-04-30 08:33:38 +000021 // TODO: Remove apex_available and restrict visibility to only mainline modules that are
22 // either outside the system server or use jarjar to rename the generated AIDL classes.
Luke Huang67649312020-04-01 01:17:42 +080023 apex_available: [
Jiyong Park90813ad2020-04-08 14:12:27 +090024 "//apex_available:platform", // used from services.net
Luke Huang67649312020-04-01 01:17:42 +080025 "com.android.bluetooth.updatable",
Hungming Chenc6ec17f2020-05-29 19:54:57 +080026 "com.android.tethering",
Luke Huang67649312020-04-01 01:17:42 +080027 "com.android.wifi",
28 ],
29 },
Luke Huangf7782042018-08-08 13:13:04 +080030 },
Luke Huang00681282019-04-26 12:09:05 +080031 versions: [
32 "1",
33 "2",
Luke Huang29e5fdf2020-04-07 16:15:23 +000034 "3",
Luke Huang00681282019-04-26 12:09:05 +080035 ],
Luke Huangcaebcbb2018-09-27 20:37:14 +080036}
37
Luke Huang0e5e69d2019-03-06 15:42:38 +080038aidl_interface {
Lorenzo Colittie90d5c42020-04-30 08:33:38 +000039 name: "netd_event_listener_interface",
40 local_include_dir: "binder",
41 srcs: [
42 "binder/android/net/metrics/INetdEventListener.aidl",
43 ],
44 versions: ["1"],
45 backend: {
46 ndk: {
47 apex_available: [
48 "//apex_available:platform",
49 "com.android.resolv",
50 ],
Jooyung Han46969792020-04-16 18:48:35 +090051 min_sdk_version: "29",
Lorenzo Colittie90d5c42020-04-30 08:33:38 +000052 },
53 },
54}
55
56aidl_interface {
Luke Huang2ff8b342019-04-30 15:33:33 +080057 // This interface is for OEM calls to netd and vice versa that do not exist in AOSP.
58 // Those calls cannot be part of INetd.aidl and INetdUnsolicitedEventListener.aidl
59 // because those interfaces are versioned.
60 // These interfaces must never be versioned or OEMs will not be able to change them.
Luke Huang0e5e69d2019-03-06 15:42:38 +080061 name: "oemnetd_aidl_interface",
Jiyong Park63917972020-04-13 15:09:35 +090062 unstable: true,
Luke Huang0e5e69d2019-03-06 15:42:38 +080063 local_include_dir: "binder",
64 srcs: [
65 "binder/com/android/internal/net/IOemNetd.aidl",
Luke Huang2ff8b342019-04-30 15:33:33 +080066 "binder/com/android/internal/net/IOemNetdUnsolicitedEventListener.aidl",
Luke Huang0e5e69d2019-03-06 15:42:38 +080067 ],
68}
69
Lorenzo Colittie90d5c42020-04-30 08:33:38 +000070// Convenience build target for the version of the netd stable AIDL interface used by the platform.
71// This exists to ensure that all non-updatable code in the system server uses the same version.
72// Mixing different versions of generated classes results in code non-deterministically(?) using one
73// of the compiled-in versions, and potentially crashing when code compiled against a newer version
74// ends up using a generated class from an older version and calls methods that don't exist.
75// This must be a frozen version on REL builds and can be -unstable on development builds.
76// See http://b/143560726 for an example.
77java_library {
78 name: "netd_aidl_interfaces-platform-java",
79 static_libs: [
80 "netd_aidl_interface-java",
81 "netd_event_listener_interface-java",
82 ],
83 // TODO: remove bluetooth, which doesn't actually use netd at all.
84 apex_available: [
Jiyong Park2c6d7942020-05-04 20:20:54 +090085 "//apex_available:platform", // due to the dependency from services.net
Lorenzo Colittie90d5c42020-04-30 08:33:38 +000086 "com.android.bluetooth.updatable",
87 ],
88 sdk_version: "system_current",
89}
90
91// These are used in netd_integration_test
92// TODO: fold these into a cc_library_static after converting netd/server to Android.bp
93filegroup {
94 name: "netd_integration_test_shared",
95 srcs: [
96 "NetdConstants.cpp",
97 "InterfaceController.cpp",
98 "NetlinkCommands.cpp",
99 "NetlinkListener.cpp",
Treehugger Robotfe5f4bd2020-06-01 15:18:04 +0000100 "OffloadUtils.cpp",
Lorenzo Colittie90d5c42020-04-30 08:33:38 +0000101 "SockDiag.cpp",
102 "XfrmController.cpp",
103 "TrafficController.cpp",
104 ],
105}
106
Bernie Innocenti98951792018-06-26 17:13:44 +0900107// Modules common to both netd and netd_unit_test
108cc_library_static {
109 name: "libnetd_server",
110 defaults: ["netd_defaults"],
111 include_dirs: [
Bernie Innocenti98951792018-06-26 17:13:44 +0900112 "system/netd/include",
113 "system/netd/server/binder",
114 ],
115 srcs: [
116 "BandwidthController.cpp",
Lorenzo Colitti7ef8c0f2019-01-11 22:34:58 +0900117 "ClatdController.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900118 "Controllers.cpp",
119 "NetdConstants.cpp",
120 "FirewallController.cpp",
121 "IdletimerController.cpp",
122 "InterfaceController.cpp",
123 "IptablesRestoreController.cpp",
124 "NFLogListener.cpp",
125 "NetlinkCommands.cpp",
126 "NetlinkListener.cpp",
127 "NetlinkManager.cpp",
Treehugger Robotfe5f4bd2020-06-01 15:18:04 +0000128 "OffloadUtils.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900129 "RouteController.cpp",
130 "SockDiag.cpp",
131 "StrictController.cpp",
132 "TcpSocketMonitor.cpp",
133 "TetherController.cpp",
134 "TrafficController.cpp",
135 "UidRanges.cpp",
136 "WakeupController.cpp",
137 "XfrmController.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900138 ],
139 shared_libs: [
Chenbo Fenga54aaf52018-11-07 17:51:51 -0800140 "libbpf_android",
Bernie Innocenti98951792018-06-26 17:13:44 +0900141 "libbase",
142 "libbinder",
Chenbo Fengd6104d12018-10-16 20:29:29 -0700143 "libnetdbpf",
Bernie Innocenti98951792018-06-26 17:13:44 +0900144 "libnetutils",
145 "libnetdutils",
146 "libpcap",
147 "libqtaguid",
148 "libssl",
Luke Huang8b4ee582020-04-14 17:42:46 +0000149 "netd_aidl_interface-cpp",
Jeongik Chab54ecec2019-10-15 17:06:59 +0900150 "netd_event_listener_interface-cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900151 ],
152 aidl: {
153 export_aidl_headers: true,
154 local_include_dirs: ["binder"],
155 },
156}
157
158cc_binary {
159 name: "netd",
160 defaults: ["netd_defaults"],
161 include_dirs: [
Bernie Innocenti98951792018-06-26 17:13:44 +0900162 "external/mdnsresponder/mDNSShared",
163 "system/netd/include",
164 ],
165 init_rc: ["netd.rc"],
Maciej Żenczykowskif428d6e2020-02-19 10:26:35 -0800166 required: [
167 "bpfloader",
168 "clatd.o",
169 "netd.o",
170 "offload.o",
171 ],
Bernie Innocenti98951792018-06-26 17:13:44 +0900172 shared_libs: [
173 "android.system.net.netd@1.0",
174 "android.system.net.netd@1.1",
Bernie Innocentif89b3512018-08-30 07:34:37 +0900175 "libbase",
Bernie Innocenti98951792018-06-26 17:13:44 +0900176 "libbinder",
Chenbo Fenga54aaf52018-11-07 17:51:51 -0800177 "libbpf_android",
Bernie Innocenti98951792018-06-26 17:13:44 +0900178 "libcutils",
179 "libdl",
180 "libhidlbase",
Jeongik Cha0f750c22019-02-22 18:43:44 +0900181 "libjsoncpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900182 "liblog",
Bernie Innocenti98951792018-06-26 17:13:44 +0900183 "libmdnssd",
Jooyung Han3e64aa12019-11-27 15:36:29 +0900184 "libnetd_resolv",
Chenbo Fengd6104d12018-10-16 20:29:29 -0700185 "libnetdbpf",
Bernie Innocenti98951792018-06-26 17:13:44 +0900186 "libnetdutils",
Bernie Innocentif89b3512018-08-30 07:34:37 +0900187 "libnetutils",
Bernie Innocenti98951792018-06-26 17:13:44 +0900188 "libpcap",
Suren Baghdasaryane072a3c2019-01-16 14:36:07 -0800189 "libprocessgroup",
Bernie Innocenti98951792018-06-26 17:13:44 +0900190 "libqtaguid",
191 "libselinux",
Bernie Innocenti98951792018-06-26 17:13:44 +0900192 "libsysutils",
Bernie Innocenti98951792018-06-26 17:13:44 +0900193 "libutils",
Luke Huang29e5fdf2020-04-07 16:15:23 +0000194 "netd_aidl_interface-cpp",
Jeongik Chab54ecec2019-10-15 17:06:59 +0900195 "netd_event_listener_interface-cpp",
Luke Huang0e5e69d2019-03-06 15:42:38 +0800196 "oemnetd_aidl_interface-cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900197 ],
198 static_libs: [
199 "libnetd_server",
Bernie Innocenti98951792018-06-26 17:13:44 +0900200 ],
201 srcs: [
Bernie Innocenti98951792018-06-26 17:13:44 +0900202 "DummyNetwork.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900203 "EventReporter.cpp",
204 "FwmarkServer.cpp",
205 "LocalNetwork.cpp",
206 "MDnsSdListener.cpp",
207 "NetdCommand.cpp",
208 "NetdHwService.cpp",
209 "NetdNativeService.cpp",
210 "NetlinkHandler.cpp",
211 "Network.cpp",
212 "NetworkController.cpp",
Luke Huang0e5e69d2019-03-06 15:42:38 +0800213 "OemNetdListener.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900214 "PhysicalNetwork.cpp",
215 "PppController.cpp",
216 "Process.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900217 "VirtualNetwork.cpp",
218 "main.cpp",
219 "oem_iptables_hook.cpp",
220 ],
Ken Chen2e413c32020-01-13 11:59:53 +0800221 sanitize: {
222 cfi: true,
Ken Chen2e413c32020-01-13 11:59:53 +0800223 },
Bernie Innocenti98951792018-06-26 17:13:44 +0900224}
225
226cc_binary {
227 name: "ndc",
228 defaults: ["netd_defaults"],
Luke Huangcfd04b22019-03-18 15:53:21 +0800229 include_dirs: [
230 "system/netd/include",
231 ],
232 header_libs: [
233 "libnetd_client_headers",
234 ],
235 shared_libs: [
236 "libbase",
237 "libnetdutils",
238 "libnetutils",
239 "libcutils",
240 "liblog",
241 "libutils",
242 "libbinder",
Jeongik Chab54ecec2019-10-15 17:06:59 +0900243 "dnsresolver_aidl_interface-cpp",
244 "netd_aidl_interface-cpp",
Luke Huangcfd04b22019-03-18 15:53:21 +0800245 ],
246 srcs: [
247 "ndc.cpp",
248 "UidRanges.cpp",
249 "NdcDispatcher.cpp",
250 ],
Ken Chen2e413c32020-01-13 11:59:53 +0800251 sanitize: {
252 cfi: true,
Ken Chen2e413c32020-01-13 11:59:53 +0800253 },
Bernie Innocenti98951792018-06-26 17:13:44 +0900254}
255
256cc_test {
257 name: "netd_unit_test",
258 defaults: ["netd_defaults"],
259 test_suites: ["device-tests"],
Bernie Innocenti83a67ca2019-06-19 16:28:05 +0900260 require_root: true,
Bernie Innocenti98951792018-06-26 17:13:44 +0900261 include_dirs: [
262 "system/netd/include",
263 "system/netd/server/binder",
264 "system/netd/tests",
Bernie Innocenti98951792018-06-26 17:13:44 +0900265 ],
266 srcs: [
267 "BandwidthControllerTest.cpp",
Lorenzo Colitti7ef8c0f2019-01-11 22:34:58 +0900268 "ClatdControllerTest.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900269 "ControllersTest.cpp",
270 "FirewallControllerTest.cpp",
271 "IdletimerControllerTest.cpp",
272 "InterfaceControllerTest.cpp",
273 "IptablesBaseTest.cpp",
274 "IptablesRestoreControllerTest.cpp",
275 "NFLogListenerTest.cpp",
Maciej Żenczykowskieec72082020-02-04 23:29:41 -0800276 "OffloadUtilsTest.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900277 "RouteControllerTest.cpp",
278 "SockDiagTest.cpp",
279 "StrictControllerTest.cpp",
280 "TetherControllerTest.cpp",
281 "TrafficControllerTest.cpp",
282 "XfrmControllerTest.cpp",
283 "WakeupControllerTest.cpp",
284 ],
285 static_libs: [
286 "libgmock",
287 "libnetd_server",
288 "libnetd_test_tun_interface",
Lorenzo Colitti3f52fae2019-06-27 18:46:22 +0900289 "libqtaguid",
Lorenzo Colittif0e051c2020-04-06 09:19:57 +0000290 "netd_aidl_interface-unstable-cpp",
Jeongik Chab54ecec2019-10-15 17:06:59 +0900291 "netd_event_listener_interface-cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900292 ],
293 shared_libs: [
294 "libbase",
295 "libbinder",
Chenbo Fenga54aaf52018-11-07 17:51:51 -0800296 "libbpf_android",
Bernie Innocenti98951792018-06-26 17:13:44 +0900297 "libcrypto",
298 "libcutils",
299 "liblog",
Chenbo Fengd6104d12018-10-16 20:29:29 -0700300 "libnetdbpf",
Bernie Innocenti98951792018-06-26 17:13:44 +0900301 "libnetdutils",
302 "libnetutils",
Bernie Innocenti98951792018-06-26 17:13:44 +0900303 "libsysutils",
304 "libutils",
305 ],
306}