blob: 79d316199efb4abe48770394617a32b1d8b45bff [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 VANa3aef342019-04-11 11:04:22 -07006 "binder/android/net/metrics/INetdEventListener.aidl",
Lorenzo Colitti57bca9f2018-12-11 13:02:05 +09007 ],
Remi NGUYEN VANf0a315e2019-05-22 22:51:59 -07008 api_dir: "aidl/netdeventlistener",
Remi NGUYEN VANfd71d792019-05-22 22:52:48 -07009 versions: ["1"],
Colin Cross1a8e7972017-12-05 22:35:52 -080010}
Steven Moreland0b7e3802018-03-02 12:41:52 -080011
Bernie Innocenti37ceb532018-06-11 21:10:44 +090012// These are used in netd_integration_test
13// TODO: fold these into a cc_library_static after converting netd/server to Android.bp
14filegroup {
15 name: "netd_integration_test_shared",
16 srcs: [
17 "NetdConstants.cpp",
18 "InterfaceController.cpp",
19 "NetlinkCommands.cpp",
Chenbo Feng49586642018-08-30 18:01:53 -070020 "NetlinkListener.cpp",
Bernie Innocenti37ceb532018-06-11 21:10:44 +090021 "XfrmController.cpp",
Chenbo Feng49586642018-08-30 18:01:53 -070022 "TrafficController.cpp",
Bernie Innocenti37ceb532018-06-11 21:10:44 +090023 ],
24}
25
Luke Huangcaebcbb2018-09-27 20:37:14 +080026aidl_interface {
27 name: "netd_aidl_interface",
28 local_include_dir: "binder",
29 srcs: [
Luke Huang03074eb2018-11-23 17:03:03 +080030 "binder/android/net/INetd.aidl",
Luke Huang528af602018-08-29 19:06:05 +080031 // AIDL interface that callers can implement to receive networking events from netd.
32 "binder/android/net/INetdUnsolicitedEventListener.aidl",
Luke Huang03074eb2018-11-23 17:03:03 +080033 "binder/android/net/InterfaceConfigurationParcel.aidl",
Luke Huangcaebcbb2018-09-27 20:37:14 +080034 "binder/android/net/TetherStatsParcel.aidl",
Luke Huang94658ac2018-10-18 19:35:12 +090035 "binder/android/net/UidRangeParcel.aidl",
Luke Huangcaebcbb2018-09-27 20:37:14 +080036 ],
Remi NGUYEN VANf0a315e2019-05-22 22:51:59 -070037 api_dir: "aidl/netd",
Luke Huangf7782042018-08-08 13:13:04 +080038 backend: {
Xiao Ma33d562a2018-12-16 16:27:38 +090039 cpp: {
40 gen_log: true,
41 },
Luke Huangf7782042018-08-08 13:13:04 +080042 },
Luke Huang6762b502019-04-26 09:12:56 -070043 versions: [
44 "1",
45 "2",
46 ],
Luke Huangcaebcbb2018-09-27 20:37:14 +080047}
48
Luke Huangbc8a80f2019-04-29 18:08:29 -070049aidl_interface {
Luke Huangfab66cb2019-05-01 09:43:51 -070050 // This interface is for OEM calls to netd and vice versa that do not exist in AOSP.
51 // Those calls cannot be part of INetd.aidl and INetdUnsolicitedEventListener.aidl
52 // because those interfaces are versioned.
53 // These interfaces must never be versioned or OEMs will not be able to change them.
Luke Huangbc8a80f2019-04-29 18:08:29 -070054 name: "oemnetd_aidl_interface",
55 local_include_dir: "binder",
56 srcs: [
57 "binder/com/android/internal/net/IOemNetd.aidl",
Luke Huangfab66cb2019-05-01 09:43:51 -070058 "binder/com/android/internal/net/IOemNetdUnsolicitedEventListener.aidl",
Luke Huangbc8a80f2019-04-29 18:08:29 -070059 ],
60}
61
Bernie Innocenti98951792018-06-26 17:13:44 +090062// Modules common to both netd and netd_unit_test
63cc_library_static {
64 name: "libnetd_server",
65 defaults: ["netd_defaults"],
66 include_dirs: [
Bernie Innocenti98951792018-06-26 17:13:44 +090067 "system/netd/include",
68 "system/netd/server/binder",
69 ],
70 srcs: [
71 "BandwidthController.cpp",
Lorenzo Colitti7ef8c0f2019-01-11 22:34:58 +090072 "ClatdController.cpp",
Maciej Żenczykowskib70da762019-01-28 15:20:48 -080073 "ClatUtils.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +090074 "Controllers.cpp",
75 "NetdConstants.cpp",
76 "FirewallController.cpp",
77 "IdletimerController.cpp",
78 "InterfaceController.cpp",
79 "IptablesRestoreController.cpp",
80 "NFLogListener.cpp",
81 "NetlinkCommands.cpp",
82 "NetlinkListener.cpp",
83 "NetlinkManager.cpp",
84 "RouteController.cpp",
85 "SockDiag.cpp",
86 "StrictController.cpp",
87 "TcpSocketMonitor.cpp",
88 "TetherController.cpp",
89 "TrafficController.cpp",
90 "UidRanges.cpp",
91 "WakeupController.cpp",
92 "XfrmController.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +090093 ],
94 shared_libs: [
Chenbo Fenga54aaf52018-11-07 17:51:51 -080095 "libbpf_android",
Bernie Innocenti98951792018-06-26 17:13:44 +090096 "libbase",
97 "libbinder",
98 "liblogwrap",
Chenbo Fengd6104d12018-10-16 20:29:29 -070099 "libnetdbpf",
Bernie Innocenti98951792018-06-26 17:13:44 +0900100 "libnetutils",
101 "libnetdutils",
102 "libpcap",
103 "libqtaguid",
104 "libssl",
Remi NGUYEN VAN9aadaf82019-05-23 01:09:36 -0700105 "netd_aidl_interface-V2-cpp",
106 "netd_event_listener_interface-V1-cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900107 ],
Lorenzo Colittiafaaa8e2018-12-18 19:16:12 +0900108 header_libs: [
109 "libnetd_resolv_headers",
110 ],
Bernie Innocenti98951792018-06-26 17:13:44 +0900111 aidl: {
112 export_aidl_headers: true,
113 local_include_dirs: ["binder"],
114 },
Lukas061059c1b632018-09-01 12:16:45 +0200115 product_variables: {
116 bliss: {
117 target_needs_netd_direct_connect_rule: {
118 cppflags: ["-DNEEDS_NETD_DIRECT_CONNECT_RULE"],
119 },
Pierre-Hugues Husson8053fa12019-07-29 18:09:12 +0200120 target_ignores_ftp_pptp_conntrack_failure: {
121 cppflags: ["-DIGNORES_FTP_PPTP_CONNTRACK_FAILURE"],
122 },
Lukas061059c1b632018-09-01 12:16:45 +0200123 },
124 },
Bernie Innocenti98951792018-06-26 17:13:44 +0900125}
126
127cc_binary {
128 name: "netd",
129 defaults: ["netd_defaults"],
130 include_dirs: [
Bernie Innocenti98951792018-06-26 17:13:44 +0900131 "external/mdnsresponder/mDNSShared",
132 "system/netd/include",
133 ],
134 init_rc: ["netd.rc"],
135 shared_libs: [
136 "android.system.net.netd@1.0",
137 "android.system.net.netd@1.1",
Bernie Innocentif89b3512018-08-30 07:34:37 +0900138 "libbase",
Bernie Innocenti98951792018-06-26 17:13:44 +0900139 "libbinder",
Chenbo Fenga54aaf52018-11-07 17:51:51 -0800140 "libbpf_android",
Bernie Innocenti98951792018-06-26 17:13:44 +0900141 "libcutils",
142 "libdl",
143 "libhidlbase",
144 "libhidltransport",
Jeongik Cha0f750c22019-02-22 18:43:44 +0900145 "libjsoncpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900146 "liblog",
147 "liblogwrap",
148 "libmdnssd",
Chenbo Fengd6104d12018-10-16 20:29:29 -0700149 "libnetdbpf",
Bernie Innocenti98951792018-06-26 17:13:44 +0900150 "libnetdutils",
Bernie Innocentif89b3512018-08-30 07:34:37 +0900151 "libnetutils",
Bernie Innocenti98951792018-06-26 17:13:44 +0900152 "libpcap",
Suren Baghdasaryane072a3c2019-01-16 14:36:07 -0800153 "libprocessgroup",
Bernie Innocenti98951792018-06-26 17:13:44 +0900154 "libqtaguid",
155 "libselinux",
Bernie Innocenti98951792018-06-26 17:13:44 +0900156 "libsysutils",
Bernie Innocenti98951792018-06-26 17:13:44 +0900157 "libutils",
Remi NGUYEN VAN9aadaf82019-05-23 01:09:36 -0700158 "netd_aidl_interface-V2-cpp",
159 "netd_event_listener_interface-V1-cpp",
Luke Huangbc8a80f2019-04-29 18:08:29 -0700160 "oemnetd_aidl_interface-cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900161 ],
162 static_libs: [
163 "libnetd_server",
Bernie Innocenti98951792018-06-26 17:13:44 +0900164 ],
Lorenzo Colittiafaaa8e2018-12-18 19:16:12 +0900165 header_libs: [
166 "libnetd_resolv_headers",
167 ],
Bernie Innocenti98951792018-06-26 17:13:44 +0900168 srcs: [
Bernie Innocenti98951792018-06-26 17:13:44 +0900169 "DummyNetwork.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900170 "EventReporter.cpp",
171 "FwmarkServer.cpp",
172 "LocalNetwork.cpp",
173 "MDnsSdListener.cpp",
174 "NetdCommand.cpp",
175 "NetdHwService.cpp",
176 "NetdNativeService.cpp",
177 "NetlinkHandler.cpp",
178 "Network.cpp",
179 "NetworkController.cpp",
Luke Huangbc8a80f2019-04-29 18:08:29 -0700180 "OemNetdListener.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900181 "PhysicalNetwork.cpp",
182 "PppController.cpp",
183 "Process.cpp",
Lorenzo Colittiafaaa8e2018-12-18 19:16:12 +0900184 "ResolvStub.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900185 "VirtualNetwork.cpp",
186 "main.cpp",
187 "oem_iptables_hook.cpp",
188 ],
189}
190
191cc_binary {
192 name: "ndc",
193 defaults: ["netd_defaults"],
Luke Huangece6f6b2019-04-24 22:18:17 -0700194 include_dirs: [
195 "system/netd/include",
196 ],
197 header_libs: [
198 "libnetd_client_headers",
199 ],
200 shared_libs: [
201 "libbase",
202 "libnetdutils",
203 "libnetutils",
204 "libcutils",
205 "liblog",
206 "libutils",
207 "libbinder",
Remi NGUYEN VAN9aadaf82019-05-23 01:09:36 -0700208 "dnsresolver_aidl_interface-V2-cpp",
209 "netd_aidl_interface-V2-cpp",
Luke Huangece6f6b2019-04-24 22:18:17 -0700210 ],
211 srcs: [
212 "ndc.cpp",
213 "UidRanges.cpp",
214 "NdcDispatcher.cpp",
215 ],
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 Innocentif0970c22019-06-19 10:14:40 -0700222 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",
227 "system/core/logwrapper/include",
228 ],
229 srcs: [
230 "BandwidthControllerTest.cpp",
Lorenzo Colitti7ef8c0f2019-01-11 22:34:58 +0900231 "ClatdControllerTest.cpp",
Maciej Żenczykowskib70da762019-01-28 15:20:48 -0800232 "ClatUtilsTest.cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900233 "ControllersTest.cpp",
234 "FirewallControllerTest.cpp",
235 "IdletimerControllerTest.cpp",
236 "InterfaceControllerTest.cpp",
237 "IptablesBaseTest.cpp",
238 "IptablesRestoreControllerTest.cpp",
239 "NFLogListenerTest.cpp",
240 "RouteControllerTest.cpp",
241 "SockDiagTest.cpp",
242 "StrictControllerTest.cpp",
243 "TetherControllerTest.cpp",
244 "TrafficControllerTest.cpp",
245 "XfrmControllerTest.cpp",
246 "WakeupControllerTest.cpp",
247 ],
248 static_libs: [
249 "libgmock",
250 "libnetd_server",
251 "libnetd_test_tun_interface",
Bernie Innocenti98951792018-06-26 17:13:44 +0900252 ],
253 shared_libs: [
254 "libbase",
255 "libbinder",
Chenbo Fenga54aaf52018-11-07 17:51:51 -0800256 "libbpf_android",
Bernie Innocenti98951792018-06-26 17:13:44 +0900257 "libcrypto",
258 "libcutils",
259 "liblog",
Chenbo Fengd6104d12018-10-16 20:29:29 -0700260 "libnetdbpf",
Bernie Innocenti98951792018-06-26 17:13:44 +0900261 "libnetdutils",
262 "libnetutils",
263 "libqtaguid",
264 "libsysutils",
265 "libutils",
Remi NGUYEN VAN9aadaf82019-05-23 01:09:36 -0700266 "netd_aidl_interface-V2-cpp",
267 "netd_event_listener_interface-V1-cpp",
Bernie Innocenti98951792018-06-26 17:13:44 +0900268 ],
269}