aidl_interface { name: "netd_aidl_interface", local_include_dir: "binder", srcs: [ "binder/android/net/INetd.aidl", // AIDL interface that callers can implement to receive networking events from netd. "binder/android/net/INetdUnsolicitedEventListener.aidl", "binder/android/net/InterfaceConfigurationParcel.aidl", "binder/android/net/MarkMaskParcel.aidl", "binder/android/net/RouteInfoParcel.aidl", "binder/android/net/TetherConfigParcel.aidl", "binder/android/net/TetherOffloadRuleParcel.aidl", "binder/android/net/TetherStatsParcel.aidl", "binder/android/net/UidRangeParcel.aidl", ], backend: { cpp: { gen_log: true, }, java: { // TODO: Remove apex_available and restrict visibility to only mainline modules that are // either outside the system server or use jarjar to rename the generated AIDL classes. apex_available: [ "//apex_available:platform", // used from services.net "com.android.bluetooth.updatable", "com.android.tethering", ], // this is part of updatable modules(NetworkStack) which targets 29(Q) min_sdk_version: "29", }, }, versions: [ "1", "2", "3", "4", ], } aidl_interface { name: "netd_event_listener_interface", local_include_dir: "binder", srcs: [ "binder/android/net/metrics/INetdEventListener.aidl", ], versions: ["1"], backend: { ndk: { apex_available: [ "//apex_available:platform", "com.android.resolv", ], min_sdk_version: "29", }, }, } aidl_interface { // This interface is for OEM calls to netd and vice versa that do not exist in AOSP. // Those calls cannot be part of INetd.aidl and INetdUnsolicitedEventListener.aidl // because those interfaces are versioned. // These interfaces must never be versioned or OEMs will not be able to change them. name: "oemnetd_aidl_interface", unstable: true, local_include_dir: "binder", srcs: [ "binder/com/android/internal/net/IOemNetd.aidl", "binder/com/android/internal/net/IOemNetdUnsolicitedEventListener.aidl", ], } // Convenience build target for the version of the netd stable AIDL interface used by the platform. // This exists to ensure that all non-updatable code in the system server uses the same version. // Mixing different versions of generated classes results in code non-deterministically(?) using one // of the compiled-in versions, and potentially crashing when code compiled against a newer version // ends up using a generated class from an older version and calls methods that don't exist. // This must be a frozen version on REL builds and can be -unstable on development builds. // See http://b/143560726 for an example. java_library { name: "netd_aidl_interfaces-platform-java", static_libs: [ "netd_aidl_interface-unstable-java", "netd_event_listener_interface-java", ], // TODO: remove bluetooth, which doesn't actually use netd at all. apex_available: [ "//apex_available:platform", // due to the dependency from services.net "com.android.bluetooth.updatable", ], sdk_version: "system_current", } // These are used in netd_integration_test // TODO: fold these into a cc_library_static after converting netd/server to Android.bp filegroup { name: "netd_integration_test_shared", srcs: [ "NetdConstants.cpp", "InterfaceController.cpp", "NetlinkCommands.cpp", "NetlinkListener.cpp", "OffloadUtils.cpp", "SockDiag.cpp", "XfrmController.cpp", "TrafficController.cpp", ], } // Modules common to both netd and netd_unit_test cc_library_static { name: "libnetd_server", defaults: ["netd_defaults"], include_dirs: [ "system/netd/include", "system/netd/server/binder", ], srcs: [ "BandwidthController.cpp", "ClatdController.cpp", "Controllers.cpp", "NetdConstants.cpp", "FirewallController.cpp", "IdletimerController.cpp", "InterfaceController.cpp", "IptablesRestoreController.cpp", "NFLogListener.cpp", "NetlinkCommands.cpp", "NetlinkListener.cpp", "NetlinkManager.cpp", "OffloadUtils.cpp", "RouteController.cpp", "SockDiag.cpp", "StrictController.cpp", "TcpSocketMonitor.cpp", "TetherController.cpp", "TrafficController.cpp", "UidRanges.cpp", "WakeupController.cpp", "XfrmController.cpp", ], shared_libs: [ "libbpf_android", "libbase", "libbinder", "libnetdbpf", "libnetutils", "libnetdutils", "libpcap", "libqtaguid", "libssl", "netd_aidl_interface-unstable-cpp", "netd_event_listener_interface-cpp", ], aidl: { export_aidl_headers: true, local_include_dirs: ["binder"], }, } cc_binary { name: "netd", defaults: ["netd_defaults"], include_dirs: [ "external/mdnsresponder/mDNSShared", "system/netd/include", ], init_rc: ["netd.rc"], required: [ "bpfloader", "clatd.o", "netd.o", "offload.o", ], shared_libs: [ "android.system.net.netd@1.0", "android.system.net.netd@1.1", "libbase", "libbinder", "libbpf_android", "libcutils", "libdl", "libhidlbase", "libjsoncpp", "liblog", "libmdnssd", "libnetd_resolv", "libnetdbpf", "libnetdutils", "libnetutils", "libpcap", "libprocessgroup", "libqtaguid", "libselinux", "libsysutils", "libutils", "netd_aidl_interface-unstable-cpp", "netd_event_listener_interface-cpp", "oemnetd_aidl_interface-cpp", ], static_libs: [ "libnetd_server", ], srcs: [ "DummyNetwork.cpp", "EventReporter.cpp", "FwmarkServer.cpp", "LocalNetwork.cpp", "MDnsSdListener.cpp", "NetdCommand.cpp", "NetdHwService.cpp", "NetdNativeService.cpp", "NetlinkHandler.cpp", "Network.cpp", "NetworkController.cpp", "OemNetdListener.cpp", "PhysicalNetwork.cpp", "PppController.cpp", "Process.cpp", "VirtualNetwork.cpp", "main.cpp", "oem_iptables_hook.cpp", ], sanitize: { cfi: true, }, } cc_binary { name: "ndc", defaults: ["netd_defaults"], include_dirs: [ "system/netd/include", ], header_libs: [ "libnetd_client_headers", ], shared_libs: [ "libbase", "libnetdutils", "libnetutils", "libcutils", "liblog", "libutils", "libbinder", "dnsresolver_aidl_interface-cpp", "netd_aidl_interface-cpp", ], srcs: [ "ndc.cpp", "UidRanges.cpp", "NdcDispatcher.cpp", ], sanitize: { cfi: true, }, } cc_test { name: "netd_unit_test", defaults: ["netd_defaults"], test_suites: ["device-tests"], require_root: true, include_dirs: [ "system/netd/include", "system/netd/server/binder", "system/netd/tests", ], srcs: [ "BandwidthControllerTest.cpp", "ClatdControllerTest.cpp", "ControllersTest.cpp", "FirewallControllerTest.cpp", "IdletimerControllerTest.cpp", "InterfaceControllerTest.cpp", "IptablesBaseTest.cpp", "IptablesRestoreControllerTest.cpp", "NFLogListenerTest.cpp", "OffloadUtilsTest.cpp", "RouteControllerTest.cpp", "SockDiagTest.cpp", "StrictControllerTest.cpp", "TetherControllerTest.cpp", "TrafficControllerTest.cpp", "XfrmControllerTest.cpp", "WakeupControllerTest.cpp", ], static_libs: [ "libgmock", "libnetd_server", "libnetd_test_tun_interface", "libqtaguid", "netd_aidl_interface-unstable-cpp", "netd_event_listener_interface-cpp", ], shared_libs: [ "libbase", "libbinder", "libbpf_android", "libcrypto", "libcutils", "liblog", "libnetdbpf", "libnetdutils", "libnetutils", "libsysutils", "libutils", ], }