blob: 64a28163bb63c1d1a7c360e8c4b4e5d498a25e27 [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",
26 "com.android.wifi",
27 ],
28 },
Luke Huangf7782042018-08-08 13:13:04 +080029 },
Luke Huang00681282019-04-26 12:09:05 +080030 versions: [
31 "1",
32 "2",
Luke Huang29e5fdf2020-04-07 16:15:23 +000033 "3",
Luke Huang00681282019-04-26 12:09:05 +080034 ],
Luke Huangcaebcbb2018-09-27 20:37:14 +080035}
36
Luke Huang0e5e69d2019-03-06 15:42:38 +080037aidl_interface {
Lorenzo Colittie90d5c42020-04-30 08:33:38 +000038 name: "netd_event_listener_interface",
39 local_include_dir: "binder",
40 srcs: [
41 "binder/android/net/metrics/INetdEventListener.aidl",
42 ],
43 versions: ["1"],
44 backend: {
45 ndk: {
46 apex_available: [
47 "//apex_available:platform",
48 "com.android.resolv",
49 ],
50 },
51 },
52}
53
54aidl_interface {
Luke Huang2ff8b342019-04-30 15:33:33 +080055 // This interface is for OEM calls to netd and vice versa that do not exist in AOSP.
56 // Those calls cannot be part of INetd.aidl and INetdUnsolicitedEventListener.aidl
57 // because those interfaces are versioned.
58 // These interfaces must never be versioned or OEMs will not be able to change them.
Luke Huang0e5e69d2019-03-06 15:42:38 +080059 name: "oemnetd_aidl_interface",
Jiyong Park63917972020-04-13 15:09:35 +090060 unstable: true,
Luke Huang0e5e69d2019-03-06 15:42:38 +080061 local_include_dir: "binder",
62 srcs: [
63 "binder/com/android/internal/net/IOemNetd.aidl",
Luke Huang2ff8b342019-04-30 15:33:33 +080064 "binder/com/android/internal/net/IOemNetdUnsolicitedEventListener.aidl",
Luke Huang0e5e69d2019-03-06 15:42:38 +080065 ],
66}
67
Lorenzo Colittie90d5c42020-04-30 08:33:38 +000068// Convenience build target for the version of the netd stable AIDL interface used by the platform.
69// This exists to ensure that all non-updatable code in the system server uses the same version.
70// Mixing different versions of generated classes results in code non-deterministically(?) using one
71// of the compiled-in versions, and potentially crashing when code compiled against a newer version
72// ends up using a generated class from an older version and calls methods that don't exist.
73// This must be a frozen version on REL builds and can be -unstable on development builds.
74// See http://b/143560726 for an example.
75java_library {
76 name: "netd_aidl_interfaces-platform-java",
77 static_libs: [
78 "netd_aidl_interface-java",
79 "netd_event_listener_interface-java",
80 ],
81 // TODO: remove bluetooth, which doesn't actually use netd at all.
82 apex_available: [
Jiyong Park2c6d7942020-05-04 20:20:54 +090083 "//apex_available:platform", // due to the dependency from services.net
Lorenzo Colittie90d5c42020-04-30 08:33:38 +000084 "com.android.bluetooth.updatable",
85 ],
86 sdk_version: "system_current",
87}
88
89// These are used in netd_integration_test
90// TODO: fold these into a cc_library_static after converting netd/server to Android.bp
91filegroup {
92 name: "netd_integration_test_shared",
93 srcs: [
94 "NetdConstants.cpp",
95 "InterfaceController.cpp",
96 "NetlinkCommands.cpp",
97 "NetlinkListener.cpp",
98 "SockDiag.cpp",
99 "XfrmController.cpp",
100 "TrafficController.cpp",
101 ],
102}
103
Bernie Innocenti98951792018-06-26 17:13:44 +0900104// Modules common to both netd and netd_unit_test
105cc_library_static {
106 name: "libnetd_server",
107 defaults: ["netd_defaults"],
108 include_dirs: [
Bernie Innocenti98951792018-06-26 17:13:44 +0900109 "system/netd/include",
110 "system/netd/server/binder",
111 ],
112 srcs: [
113 "BandwidthController.cpp",
Lorenzo Colitti7ef8c0f2019-01-11 22:34:58 +0900114 "ClatdController.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900115 "Controllers.cpp",
116 "NetdConstants.cpp",
117 "FirewallController.cpp",
118 "IdletimerController.cpp",
119 "InterfaceController.cpp",
120 "IptablesRestoreController.cpp",
121 "NFLogListener.cpp",
122 "NetlinkCommands.cpp",
123 "NetlinkListener.cpp",
124 "NetlinkManager.cpp",
Maciej Żenczykowskieec72082020-02-04 23:29:41 -0800125 "OffloadUtils.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900126 "RouteController.cpp",
127 "SockDiag.cpp",
128 "StrictController.cpp",
129 "TcpSocketMonitor.cpp",
130 "TetherController.cpp",
131 "TrafficController.cpp",
132 "UidRanges.cpp",
133 "WakeupController.cpp",
134 "XfrmController.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900135 ],
136 shared_libs: [
Chenbo Fenga54aaf52018-11-07 17:51:51 -0800137 "libbpf_android",
Bernie Innocenti98951792018-06-26 17:13:44 +0900138 "libbase",
139 "libbinder",
Chenbo Fengd6104d12018-10-16 20:29:29 -0700140 "libnetdbpf",
Bernie Innocenti98951792018-06-26 17:13:44 +0900141 "libnetutils",
142 "libnetdutils",
143 "libpcap",
144 "libqtaguid",
145 "libssl",
Luke Huang8b4ee582020-04-14 17:42:46 +0000146 "netd_aidl_interface-cpp",
Jeongik Chab54ecec2019-10-15 17:06:59 +0900147 "netd_event_listener_interface-cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900148 ],
149 aidl: {
150 export_aidl_headers: true,
151 local_include_dirs: ["binder"],
152 },
153}
154
155cc_binary {
156 name: "netd",
157 defaults: ["netd_defaults"],
158 include_dirs: [
Bernie Innocenti98951792018-06-26 17:13:44 +0900159 "external/mdnsresponder/mDNSShared",
160 "system/netd/include",
161 ],
162 init_rc: ["netd.rc"],
Maciej Żenczykowskif428d6e2020-02-19 10:26:35 -0800163 required: [
164 "bpfloader",
165 "clatd.o",
166 "netd.o",
167 "offload.o",
168 ],
Bernie Innocenti98951792018-06-26 17:13:44 +0900169 shared_libs: [
170 "android.system.net.netd@1.0",
171 "android.system.net.netd@1.1",
Bernie Innocentif89b3512018-08-30 07:34:37 +0900172 "libbase",
Bernie Innocenti98951792018-06-26 17:13:44 +0900173 "libbinder",
Chenbo Fenga54aaf52018-11-07 17:51:51 -0800174 "libbpf_android",
Bernie Innocenti98951792018-06-26 17:13:44 +0900175 "libcutils",
176 "libdl",
177 "libhidlbase",
Jeongik Cha0f750c22019-02-22 18:43:44 +0900178 "libjsoncpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900179 "liblog",
Bernie Innocenti98951792018-06-26 17:13:44 +0900180 "libmdnssd",
Jooyung Han3e64aa12019-11-27 15:36:29 +0900181 "libnetd_resolv",
Chenbo Fengd6104d12018-10-16 20:29:29 -0700182 "libnetdbpf",
Bernie Innocenti98951792018-06-26 17:13:44 +0900183 "libnetdutils",
Bernie Innocentif89b3512018-08-30 07:34:37 +0900184 "libnetutils",
Bernie Innocenti98951792018-06-26 17:13:44 +0900185 "libpcap",
Suren Baghdasaryane072a3c2019-01-16 14:36:07 -0800186 "libprocessgroup",
Bernie Innocenti98951792018-06-26 17:13:44 +0900187 "libqtaguid",
188 "libselinux",
Bernie Innocenti98951792018-06-26 17:13:44 +0900189 "libsysutils",
Bernie Innocenti98951792018-06-26 17:13:44 +0900190 "libutils",
Luke Huang29e5fdf2020-04-07 16:15:23 +0000191 "netd_aidl_interface-cpp",
Jeongik Chab54ecec2019-10-15 17:06:59 +0900192 "netd_event_listener_interface-cpp",
Luke Huang0e5e69d2019-03-06 15:42:38 +0800193 "oemnetd_aidl_interface-cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900194 ],
195 static_libs: [
196 "libnetd_server",
Bernie Innocenti98951792018-06-26 17:13:44 +0900197 ],
198 srcs: [
Bernie Innocenti98951792018-06-26 17:13:44 +0900199 "DummyNetwork.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900200 "EventReporter.cpp",
201 "FwmarkServer.cpp",
202 "LocalNetwork.cpp",
203 "MDnsSdListener.cpp",
204 "NetdCommand.cpp",
205 "NetdHwService.cpp",
206 "NetdNativeService.cpp",
207 "NetlinkHandler.cpp",
208 "Network.cpp",
209 "NetworkController.cpp",
Luke Huang0e5e69d2019-03-06 15:42:38 +0800210 "OemNetdListener.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900211 "PhysicalNetwork.cpp",
212 "PppController.cpp",
213 "Process.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900214 "VirtualNetwork.cpp",
215 "main.cpp",
216 "oem_iptables_hook.cpp",
217 ],
Ken Chen2e413c32020-01-13 11:59:53 +0800218 sanitize: {
219 cfi: true,
Ken Chen2e413c32020-01-13 11:59:53 +0800220 },
Bernie Innocenti98951792018-06-26 17:13:44 +0900221}
222
223cc_binary {
224 name: "ndc",
225 defaults: ["netd_defaults"],
Luke Huangcfd04b22019-03-18 15:53:21 +0800226 include_dirs: [
227 "system/netd/include",
228 ],
229 header_libs: [
230 "libnetd_client_headers",
231 ],
232 shared_libs: [
233 "libbase",
234 "libnetdutils",
235 "libnetutils",
236 "libcutils",
237 "liblog",
238 "libutils",
239 "libbinder",
Jeongik Chab54ecec2019-10-15 17:06:59 +0900240 "dnsresolver_aidl_interface-cpp",
241 "netd_aidl_interface-cpp",
Luke Huangcfd04b22019-03-18 15:53:21 +0800242 ],
243 srcs: [
244 "ndc.cpp",
245 "UidRanges.cpp",
246 "NdcDispatcher.cpp",
247 ],
Ken Chen2e413c32020-01-13 11:59:53 +0800248 sanitize: {
249 cfi: true,
Ken Chen2e413c32020-01-13 11:59:53 +0800250 },
Bernie Innocenti98951792018-06-26 17:13:44 +0900251}
252
253cc_test {
254 name: "netd_unit_test",
255 defaults: ["netd_defaults"],
256 test_suites: ["device-tests"],
Bernie Innocenti83a67ca2019-06-19 16:28:05 +0900257 require_root: true,
Bernie Innocenti98951792018-06-26 17:13:44 +0900258 include_dirs: [
259 "system/netd/include",
260 "system/netd/server/binder",
261 "system/netd/tests",
Bernie Innocenti98951792018-06-26 17:13:44 +0900262 ],
263 srcs: [
264 "BandwidthControllerTest.cpp",
Lorenzo Colitti7ef8c0f2019-01-11 22:34:58 +0900265 "ClatdControllerTest.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900266 "ControllersTest.cpp",
267 "FirewallControllerTest.cpp",
268 "IdletimerControllerTest.cpp",
269 "InterfaceControllerTest.cpp",
270 "IptablesBaseTest.cpp",
271 "IptablesRestoreControllerTest.cpp",
272 "NFLogListenerTest.cpp",
Maciej Żenczykowskieec72082020-02-04 23:29:41 -0800273 "OffloadUtilsTest.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900274 "RouteControllerTest.cpp",
275 "SockDiagTest.cpp",
276 "StrictControllerTest.cpp",
277 "TetherControllerTest.cpp",
278 "TrafficControllerTest.cpp",
279 "XfrmControllerTest.cpp",
280 "WakeupControllerTest.cpp",
281 ],
282 static_libs: [
283 "libgmock",
284 "libnetd_server",
285 "libnetd_test_tun_interface",
Lorenzo Colitti3f52fae2019-06-27 18:46:22 +0900286 "libqtaguid",
Lorenzo Colittif0e051c2020-04-06 09:19:57 +0000287 "netd_aidl_interface-unstable-cpp",
Jeongik Chab54ecec2019-10-15 17:06:59 +0900288 "netd_event_listener_interface-cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900289 ],
290 shared_libs: [
291 "libbase",
292 "libbinder",
Chenbo Fenga54aaf52018-11-07 17:51:51 -0800293 "libbpf_android",
Bernie Innocenti98951792018-06-26 17:13:44 +0900294 "libcrypto",
295 "libcutils",
296 "liblog",
Chenbo Fengd6104d12018-10-16 20:29:29 -0700297 "libnetdbpf",
Bernie Innocenti98951792018-06-26 17:13:44 +0900298 "libnetdutils",
299 "libnetutils",
Bernie Innocenti98951792018-06-26 17:13:44 +0900300 "libsysutils",
301 "libutils",
302 ],
303}