• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1package {
2    default_applicable_licenses: ["external_android-clat_license"],
3}
4
5// Added automatically by a large-scale-change
6//
7// large-scale-change included anything that looked like it might be a license
8// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
9//
10// Please consider removing redundant or irrelevant files from 'license_text:'.
11// See: http://go/android-license-faq
12license {
13    name: "external_android-clat_license",
14    visibility: [":__subpackages__"],
15    license_kinds: [
16        "SPDX-license-identifier-Apache-2.0",
17    ],
18    license_text: [
19        "LICENSE",
20        "NOTICE",
21    ],
22}
23
24cc_defaults {
25    name: "clatd_defaults",
26
27    cflags: [
28        "-Wall",
29        "-Werror",
30        "-Wunused-parameter",
31
32        // Bug: http://b/33566695
33        "-Wno-address-of-packed-member",
34    ],
35}
36
37// Code used both by the daemon and by unit tests.
38filegroup {
39    name: "clatd_common",
40    srcs: [
41        "clatd.c",
42        "dump.c",
43        "getaddr.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    sanitize: {
92        memtag_heap: true,
93    },
94
95    apex_available: [
96        "com.android.tethering",
97        "//apex_available:platform",
98    ],
99    min_sdk_version: "30",
100}
101
102// Unit tests.
103cc_test {
104    name: "clatd_test",
105    defaults: ["clatd_defaults"],
106    srcs: [
107        ":clatd_common",
108        "clatd_test.cpp"
109    ],
110    static_libs: [
111        "libbase",
112        "libip_checksum",
113        "libnetd_test_tun_interface",
114    ],
115    shared_libs: [
116        "libcutils",
117        "liblog",
118        "libnetutils",
119    ],
120    test_suites: ["device-tests"],
121    require_root: true,
122}
123