1package {
2    default_team: "trendy_team_fwk_core_networking",
3    default_applicable_licenses: ["external_android-clat_license"],
4}
5
6// Added automatically by a large-scale-change
7//
8// large-scale-change included anything that looked like it might be a license
9// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
10//
11// Please consider removing redundant or irrelevant files from 'license_text:'.
12// See: http://go/android-license-faq
13license {
14    name: "external_android-clat_license",
15    visibility: [":__subpackages__"],
16    license_kinds: [
17        "SPDX-license-identifier-Apache-2.0",
18    ],
19    license_text: [
20        "LICENSE",
21        "NOTICE",
22    ],
23}
24
25cc_defaults {
26    name: "clatd_defaults",
27
28    cflags: [
29        "-Wall",
30        "-Werror",
31        "-Wunused-parameter",
32
33        // Bug: http://b/33566695
34        "-Wno-address-of-packed-member",
35    ],
36}
37
38// Code used both by the daemon and by unit tests.
39filegroup {
40    name: "clatd_common",
41    srcs: [
42        "clatd.c",
43        "dump.c",
44        "icmp.c",
45        "ipv4.c",
46        "ipv6.c",
47        "logging.c",
48        "translate.c",
49    ],
50}
51
52// The clat daemon.
53cc_binary {
54    name: "clatd",
55    defaults: ["clatd_defaults"],
56    srcs: [
57        ":clatd_common",
58        "main.c",
59    ],
60    static_libs: [
61        "libip_checksum",
62    ],
63    shared_libs: [
64        "liblog",
65    ],
66    relative_install_path: "for-system",
67
68    // Static libc++ for smaller apex size while shipping clatd in the mainline module.
69    // See b/213123047
70    stl: "libc++_static",
71
72    // Only enable clang-tidy for the daemon, not the tests, because enabling it for the
73    // tests substantially increases build/compile cycle times and doesn't really provide a
74    // security benefit.
75    tidy: true,
76    tidy_checks: [
77        "-*",
78        "cert-*",
79        "clang-analyzer-security*",
80        // b/2043314, warnings on memcpy_s, memset_s, snprintf_s calls
81        // are blocking the migration from gnu99 to gnu11.
82        // Until those warnings are fixed, disable these checks.
83        "-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling",
84        "android-*",
85    ],
86    tidy_checks_as_errors: [
87        "clang-analyzer-security*",
88        "cert-*",
89        "android-*",
90    ],
91
92    apex_available: [
93        "com.android.tethering",
94        "//apex_available:platform",
95    ],
96    min_sdk_version: "30",
97}
98
99// Unit tests.
100cc_test {
101    name: "clatd_test",
102    defaults: ["clatd_defaults"],
103    srcs: [
104        ":clatd_common",
105        "clatd_test.cpp",
106    ],
107    static_libs: [
108        "libbase",
109        "libip_checksum",
110        "libnetd_test_tun_interface",
111    ],
112    shared_libs: [
113        "libcutils",
114        "liblog",
115        "libnetutils",
116    ],
117    test_suites: ["device-tests"],
118    require_root: true,
119}
120