1# Copyright (C) 2014 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15LOCAL_PATH := $(call my-dir)
16
17###
18### netd service AIDL interface.
19###
20include $(CLEAR_VARS)
21
22LOCAL_CFLAGS := -Wall -Werror -Wthread-safety
23LOCAL_MODULE := libnetdaidl_static
24LOCAL_SHARED_LIBRARIES := \
25        libbinder \
26        libutils
27LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/binder
28LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/binder frameworks/native/aidl/binder
29LOCAL_C_INCLUDES := $(LOCAL_PATH)/binder
30LOCAL_SRC_FILES := \
31        binder/android/net/INetd.aidl \
32        binder/android/net/UidRange.cpp
33
34include $(BUILD_STATIC_LIBRARY)
35
36include $(CLEAR_VARS)
37
38LOCAL_CFLAGS := -Wall -Werror -Wthread-safety
39LOCAL_MODULE := libnetdaidl
40LOCAL_SHARED_LIBRARIES := \
41        libbinder \
42        libutils
43LOCAL_WHOLE_STATIC_LIBRARIES := libnetdaidl_static
44LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/binder
45
46include $(BUILD_SHARED_LIBRARY)
47
48###
49### netd daemon.
50###
51include $(CLEAR_VARS)
52
53LOCAL_C_INCLUDES := \
54        $(call include-path-for, libhardware_legacy)/hardware_legacy \
55        bionic/libc/dns/include \
56        external/mdnsresponder/mDNSShared \
57        system/netd/include \
58
59LOCAL_CPPFLAGS := -Wall -Werror -Wthread-safety -Wnullable-to-nonnull-conversion
60LOCAL_MODULE := netd
61
62# Bug: http://b/29823425 Disable -Wvarargs for Clang update to r271374
63LOCAL_CPPFLAGS +=  -Wno-varargs \
64
65ifeq ($(TARGET_ARCH), x86)
66ifneq ($(TARGET_PRODUCT), gce_x86_phone)
67        LOCAL_CPPFLAGS += -D NETLINK_COMPAT32
68endif
69endif
70
71LOCAL_INIT_RC := netd.rc
72
73LOCAL_SHARED_LIBRARIES := \
74        android.system.net.netd@1.0 \
75        android.system.net.netd@1.1 \
76        libbinder \
77        libbpf    \
78        libcrypto \
79        libcutils \
80        libdl \
81        libhidlbase \
82        libhidltransport \
83        liblog \
84        liblogwrap \
85        libmdnssd \
86        libnetdaidl \
87        libnetutils \
88        libnetdutils \
89        libselinux \
90        libssl \
91        libsysutils \
92        libbase \
93        libutils \
94        libpcap \
95        libqtaguid \
96
97LOCAL_SRC_FILES := \
98        BandwidthController.cpp \
99        ClatdController.cpp \
100        CommandListener.cpp \
101        Controllers.cpp \
102        DnsProxyListener.cpp \
103        DummyNetwork.cpp \
104        DumpWriter.cpp \
105        EventReporter.cpp \
106        FirewallController.cpp \
107        FwmarkServer.cpp \
108        IdletimerController.cpp \
109        InterfaceController.cpp \
110        IptablesRestoreController.cpp \
111        LocalNetwork.cpp \
112        MDnsSdListener.cpp \
113        NetdCommand.cpp \
114        NetdConstants.cpp \
115        NetdHwService.cpp \
116        NetdNativeService.cpp \
117        NetlinkHandler.cpp \
118        NetlinkManager.cpp \
119        NetlinkCommands.cpp \
120        NetlinkListener.cpp \
121        Network.cpp \
122        NetworkController.cpp \
123        NFLogListener.cpp \
124        PhysicalNetwork.cpp \
125        PppController.cpp \
126        ResolverController.cpp \
127        RouteController.cpp \
128        SockDiag.cpp \
129        StrictController.cpp \
130        TetherController.cpp \
131        TrafficController.cpp \
132        UidRanges.cpp \
133        VirtualNetwork.cpp \
134        WakeupController.cpp \
135        XfrmController.cpp \
136        TcpSocketMonitor.cpp \
137        main.cpp \
138        oem_iptables_hook.cpp \
139        binder/android/net/UidRange.cpp \
140        binder/android/net/metrics/INetdEventListener.aidl \
141        dns/DnsTlsDispatcher.cpp \
142        dns/DnsTlsQueryMap.cpp \
143        dns/DnsTlsTransport.cpp \
144        dns/DnsTlsServer.cpp \
145        dns/DnsTlsSessionCache.cpp \
146        dns/DnsTlsSocket.cpp \
147
148LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/binder
149
150include $(BUILD_EXECUTABLE)
151
152
153###
154### ndc binary.
155###
156include $(CLEAR_VARS)
157
158LOCAL_CFLAGS := -Wall -Werror -Wthread-safety
159LOCAL_SANITIZE := unsigned-integer-overflow
160LOCAL_CLANG := true
161LOCAL_MODULE := ndc
162LOCAL_SHARED_LIBRARIES := libcutils
163LOCAL_SRC_FILES := ndc.cpp
164
165include $(BUILD_EXECUTABLE)
166
167###
168### netd unit tests.
169###
170include $(CLEAR_VARS)
171LOCAL_MODULE := netd_unit_test
172LOCAL_COMPATIBILITY_SUITE := device-tests
173LOCAL_SANITIZE := unsigned-integer-overflow
174LOCAL_CFLAGS := -Wall -Werror -Wunused-parameter -Wthread-safety
175# Bug: http://b/29823425 Disable -Wvarargs for Clang update to r271374
176LOCAL_CFLAGS += -Wno-varargs
177
178LOCAL_C_INCLUDES := \
179        bionic/libc/dns/include \
180        system/netd/include \
181        system/netd/server \
182        system/netd/server/binder \
183        system/netd/tests \
184        system/core/logwrapper/include \
185
186LOCAL_SRC_FILES := \
187        InterfaceController.cpp InterfaceControllerTest.cpp \
188        Controllers.cpp ControllersTest.cpp \
189        NetdConstants.cpp IptablesBaseTest.cpp \
190        IptablesRestoreController.cpp IptablesRestoreControllerTest.cpp \
191        BandwidthController.cpp BandwidthControllerTest.cpp \
192        FirewallControllerTest.cpp FirewallController.cpp \
193        IdletimerController.cpp IdletimerControllerTest.cpp \
194        NetlinkCommands.cpp NetlinkManager.cpp \
195        RouteController.cpp RouteControllerTest.cpp \
196        SockDiagTest.cpp SockDiag.cpp \
197        StrictController.cpp StrictControllerTest.cpp \
198        TetherController.cpp TetherControllerTest.cpp \
199        TrafficController.cpp TrafficControllerTest.cpp \
200        XfrmController.cpp XfrmControllerTest.cpp \
201        TcpSocketMonitor.cpp \
202        UidRanges.cpp \
203        NetlinkListener.cpp \
204        WakeupController.cpp WakeupControllerTest.cpp \
205        NFLogListener.cpp NFLogListenerTest.cpp \
206        binder/android/net/UidRange.cpp \
207        binder/android/net/metrics/INetdEventListener.aidl \
208        ../tests/tun_interface.cpp \
209        dns/DnsTlsDispatcher.cpp \
210        dns/DnsTlsTransport.cpp \
211        dns/DnsTlsServer.cpp \
212        dns/DnsTlsSessionCache.cpp \
213        dns/DnsTlsSocket.cpp \
214
215LOCAL_MODULE_TAGS := tests
216LOCAL_STATIC_LIBRARIES := libgmock libpcap
217LOCAL_SHARED_LIBRARIES := \
218        libbpf    \
219        libnetdaidl \
220        libbase \
221        libbinder \
222        libcrypto \
223        libcutils \
224        liblog \
225        liblogwrap \
226        libnetutils \
227        libnetdutils \
228        libqtaguid \
229        libsysutils \
230        libutils \
231        libssl \
232
233include $(BUILD_NATIVE_TEST)
234
235