blob: 4c548ea787c72a409232b95974ee2ddb56052b45 [file] [log] [blame]
Colin Cross1a8e7972017-12-05 22:35:52 -08001// AIDL interface between netd and services.core
Lorenzo Colitti57bca9f2018-12-11 13:02:05 +09002aidl_interface {
3 name: "netd_event_listener_interface",
4 local_include_dir: "binder",
5 srcs: [
Remi NGUYEN VAN6b91b492019-04-09 13:57:03 +09006 "binder/android/net/metrics/INetdEventListener.aidl",
Lorenzo Colitti57bca9f2018-12-11 13:02:05 +09007 ],
Lorenzo Colitti866a03a2019-05-22 15:46:05 +09008 versions: ["1"],
Colin Cross1a8e7972017-12-05 22:35:52 -08009}
Steven Moreland0b7e3802018-03-02 12:41:52 -080010
Bernie Innocenti37ceb532018-06-11 21:10:44 +090011// These are used in netd_integration_test
12// TODO: fold these into a cc_library_static after converting netd/server to Android.bp
13filegroup {
14 name: "netd_integration_test_shared",
15 srcs: [
16 "NetdConstants.cpp",
17 "InterfaceController.cpp",
18 "NetlinkCommands.cpp",
Chenbo Feng49586642018-08-30 18:01:53 -070019 "NetlinkListener.cpp",
Bernie Innocenti37ceb532018-06-11 21:10:44 +090020 "XfrmController.cpp",
Chenbo Feng49586642018-08-30 18:01:53 -070021 "TrafficController.cpp",
Bernie Innocenti37ceb532018-06-11 21:10:44 +090022 ],
23}
24
Luke Huangcaebcbb2018-09-27 20:37:14 +080025aidl_interface {
26 name: "netd_aidl_interface",
27 local_include_dir: "binder",
28 srcs: [
Luke Huang03074eb2018-11-23 17:03:03 +080029 "binder/android/net/INetd.aidl",
Luke Huang528af602018-08-29 19:06:05 +080030 // AIDL interface that callers can implement to receive networking events from netd.
31 "binder/android/net/INetdUnsolicitedEventListener.aidl",
Luke Huang03074eb2018-11-23 17:03:03 +080032 "binder/android/net/InterfaceConfigurationParcel.aidl",
Chiachang Wang00fc62f2019-12-04 20:38:26 +080033 "binder/android/net/MarkMaskParcel.aidl",
Tyler Wearfa94a272019-12-05 15:01:48 -080034 "binder/android/net/RouteInfoParcel.aidl",
Chiachang Wang08cb2112019-12-10 09:53:24 +080035 "binder/android/net/TetherConfigParcel.aidl",
Luke Huangcaebcbb2018-09-27 20:37:14 +080036 "binder/android/net/TetherStatsParcel.aidl",
Luke Huang94658ac2018-10-18 19:35:12 +090037 "binder/android/net/UidRangeParcel.aidl",
Luke Huangcaebcbb2018-09-27 20:37:14 +080038 ],
Luke Huangf7782042018-08-08 13:13:04 +080039 backend: {
Xiao Ma33d562a2018-12-16 16:27:38 +090040 cpp: {
41 gen_log: true,
42 },
Luke Huang67649312020-04-01 01:17:42 +080043 java: {
44 apex_available: [
45 "com.android.bluetooth.updatable",
46 "com.android.wifi",
47 ],
48 },
Luke Huangf7782042018-08-08 13:13:04 +080049 },
Luke Huang00681282019-04-26 12:09:05 +080050 versions: [
51 "1",
52 "2",
53 ],
Luke Huangcaebcbb2018-09-27 20:37:14 +080054}
55
Luke Huang0e5e69d2019-03-06 15:42:38 +080056aidl_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",
62 local_include_dir: "binder",
63 srcs: [
64 "binder/com/android/internal/net/IOemNetd.aidl",
Luke Huang2ff8b342019-04-30 15:33:33 +080065 "binder/com/android/internal/net/IOemNetdUnsolicitedEventListener.aidl",
Luke Huang0e5e69d2019-03-06 15:42:38 +080066 ],
67}
68
Bernie Innocenti98951792018-06-26 17:13:44 +090069// Modules common to both netd and netd_unit_test
70cc_library_static {
71 name: "libnetd_server",
72 defaults: ["netd_defaults"],
73 include_dirs: [
Bernie Innocenti98951792018-06-26 17:13:44 +090074 "system/netd/include",
75 "system/netd/server/binder",
76 ],
77 srcs: [
78 "BandwidthController.cpp",
Lorenzo Colitti7ef8c0f2019-01-11 22:34:58 +090079 "ClatdController.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +090080 "Controllers.cpp",
81 "NetdConstants.cpp",
82 "FirewallController.cpp",
83 "IdletimerController.cpp",
84 "InterfaceController.cpp",
85 "IptablesRestoreController.cpp",
86 "NFLogListener.cpp",
87 "NetlinkCommands.cpp",
88 "NetlinkListener.cpp",
89 "NetlinkManager.cpp",
Maciej Żenczykowskieec72082020-02-04 23:29:41 -080090 "OffloadUtils.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +090091 "RouteController.cpp",
92 "SockDiag.cpp",
93 "StrictController.cpp",
94 "TcpSocketMonitor.cpp",
95 "TetherController.cpp",
96 "TrafficController.cpp",
97 "UidRanges.cpp",
98 "WakeupController.cpp",
99 "XfrmController.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900100 ],
101 shared_libs: [
Chenbo Fenga54aaf52018-11-07 17:51:51 -0800102 "libbpf_android",
Bernie Innocenti98951792018-06-26 17:13:44 +0900103 "libbase",
104 "libbinder",
Chenbo Fengd6104d12018-10-16 20:29:29 -0700105 "libnetdbpf",
Bernie Innocenti98951792018-06-26 17:13:44 +0900106 "libnetutils",
107 "libnetdutils",
108 "libpcap",
109 "libqtaguid",
110 "libssl",
Luke Huang91bd3e12019-08-20 11:33:52 +0800111 "netd_aidl_interface-cpp",
Jeongik Chab54ecec2019-10-15 17:06:59 +0900112 "netd_event_listener_interface-cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900113 ],
114 aidl: {
115 export_aidl_headers: true,
116 local_include_dirs: ["binder"],
117 },
118}
119
120cc_binary {
121 name: "netd",
122 defaults: ["netd_defaults"],
123 include_dirs: [
Bernie Innocenti98951792018-06-26 17:13:44 +0900124 "external/mdnsresponder/mDNSShared",
125 "system/netd/include",
126 ],
127 init_rc: ["netd.rc"],
Maciej Żenczykowskif428d6e2020-02-19 10:26:35 -0800128 required: [
129 "bpfloader",
130 "clatd.o",
131 "netd.o",
132 "offload.o",
133 ],
Bernie Innocenti98951792018-06-26 17:13:44 +0900134 shared_libs: [
135 "android.system.net.netd@1.0",
136 "android.system.net.netd@1.1",
Bernie Innocentif89b3512018-08-30 07:34:37 +0900137 "libbase",
Bernie Innocenti98951792018-06-26 17:13:44 +0900138 "libbinder",
Chenbo Fenga54aaf52018-11-07 17:51:51 -0800139 "libbpf_android",
Bernie Innocenti98951792018-06-26 17:13:44 +0900140 "libcutils",
141 "libdl",
142 "libhidlbase",
Jeongik Cha0f750c22019-02-22 18:43:44 +0900143 "libjsoncpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900144 "liblog",
Bernie Innocenti98951792018-06-26 17:13:44 +0900145 "libmdnssd",
Jooyung Han3e64aa12019-11-27 15:36:29 +0900146 "libnetd_resolv",
Chenbo Fengd6104d12018-10-16 20:29:29 -0700147 "libnetdbpf",
Bernie Innocenti98951792018-06-26 17:13:44 +0900148 "libnetdutils",
Bernie Innocentif89b3512018-08-30 07:34:37 +0900149 "libnetutils",
Bernie Innocenti98951792018-06-26 17:13:44 +0900150 "libpcap",
Suren Baghdasaryane072a3c2019-01-16 14:36:07 -0800151 "libprocessgroup",
Bernie Innocenti98951792018-06-26 17:13:44 +0900152 "libqtaguid",
153 "libselinux",
Bernie Innocenti98951792018-06-26 17:13:44 +0900154 "libsysutils",
Bernie Innocenti98951792018-06-26 17:13:44 +0900155 "libutils",
Jeongik Chab54ecec2019-10-15 17:06:59 +0900156 "netd_aidl_interface-unstable-cpp",
157 "netd_event_listener_interface-cpp",
Luke Huang0e5e69d2019-03-06 15:42:38 +0800158 "oemnetd_aidl_interface-cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900159 ],
160 static_libs: [
161 "libnetd_server",
Bernie Innocenti98951792018-06-26 17:13:44 +0900162 ],
163 srcs: [
Bernie Innocenti98951792018-06-26 17:13:44 +0900164 "DummyNetwork.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900165 "EventReporter.cpp",
166 "FwmarkServer.cpp",
167 "LocalNetwork.cpp",
168 "MDnsSdListener.cpp",
169 "NetdCommand.cpp",
170 "NetdHwService.cpp",
171 "NetdNativeService.cpp",
172 "NetlinkHandler.cpp",
173 "Network.cpp",
174 "NetworkController.cpp",
Luke Huang0e5e69d2019-03-06 15:42:38 +0800175 "OemNetdListener.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900176 "PhysicalNetwork.cpp",
177 "PppController.cpp",
178 "Process.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900179 "VirtualNetwork.cpp",
180 "main.cpp",
181 "oem_iptables_hook.cpp",
182 ],
Ken Chen2e413c32020-01-13 11:59:53 +0800183 sanitize: {
184 cfi: true,
Ken Chen2e413c32020-01-13 11:59:53 +0800185 },
Bernie Innocenti98951792018-06-26 17:13:44 +0900186}
187
188cc_binary {
189 name: "ndc",
190 defaults: ["netd_defaults"],
Luke Huangcfd04b22019-03-18 15:53:21 +0800191 include_dirs: [
192 "system/netd/include",
193 ],
194 header_libs: [
195 "libnetd_client_headers",
196 ],
197 shared_libs: [
198 "libbase",
199 "libnetdutils",
200 "libnetutils",
201 "libcutils",
202 "liblog",
203 "libutils",
204 "libbinder",
Jeongik Chab54ecec2019-10-15 17:06:59 +0900205 "dnsresolver_aidl_interface-cpp",
206 "netd_aidl_interface-cpp",
Luke Huangcfd04b22019-03-18 15:53:21 +0800207 ],
208 srcs: [
209 "ndc.cpp",
210 "UidRanges.cpp",
211 "NdcDispatcher.cpp",
212 ],
Ken Chen2e413c32020-01-13 11:59:53 +0800213 sanitize: {
214 cfi: true,
Ken Chen2e413c32020-01-13 11:59:53 +0800215 },
Bernie Innocenti98951792018-06-26 17:13:44 +0900216}
217
218cc_test {
219 name: "netd_unit_test",
220 defaults: ["netd_defaults"],
221 test_suites: ["device-tests"],
Bernie Innocenti83a67ca2019-06-19 16:28:05 +0900222 require_root: true,
Bernie Innocenti98951792018-06-26 17:13:44 +0900223 include_dirs: [
224 "system/netd/include",
225 "system/netd/server/binder",
226 "system/netd/tests",
Bernie Innocenti98951792018-06-26 17:13:44 +0900227 ],
228 srcs: [
229 "BandwidthControllerTest.cpp",
Lorenzo Colitti7ef8c0f2019-01-11 22:34:58 +0900230 "ClatdControllerTest.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900231 "ControllersTest.cpp",
232 "FirewallControllerTest.cpp",
233 "IdletimerControllerTest.cpp",
234 "InterfaceControllerTest.cpp",
235 "IptablesBaseTest.cpp",
236 "IptablesRestoreControllerTest.cpp",
237 "NFLogListenerTest.cpp",
Maciej Żenczykowskieec72082020-02-04 23:29:41 -0800238 "OffloadUtilsTest.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900239 "RouteControllerTest.cpp",
240 "SockDiagTest.cpp",
241 "StrictControllerTest.cpp",
242 "TetherControllerTest.cpp",
243 "TrafficControllerTest.cpp",
244 "XfrmControllerTest.cpp",
245 "WakeupControllerTest.cpp",
246 ],
247 static_libs: [
248 "libgmock",
249 "libnetd_server",
250 "libnetd_test_tun_interface",
Lorenzo Colitti3f52fae2019-06-27 18:46:22 +0900251 "libqtaguid",
Jeongik Chab54ecec2019-10-15 17:06:59 +0900252 "netd_aidl_interface-cpp",
253 "netd_event_listener_interface-cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900254 ],
255 shared_libs: [
256 "libbase",
257 "libbinder",
Chenbo Fenga54aaf52018-11-07 17:51:51 -0800258 "libbpf_android",
Bernie Innocenti98951792018-06-26 17:13:44 +0900259 "libcrypto",
260 "libcutils",
261 "liblog",
Chenbo Fengd6104d12018-10-16 20:29:29 -0700262 "libnetdbpf",
Bernie Innocenti98951792018-06-26 17:13:44 +0900263 "libnetdutils",
264 "libnetutils",
Bernie Innocenti98951792018-06-26 17:13:44 +0900265 "libsysutils",
266 "libutils",
267 ],
268}