summaryrefslogtreecommitdiff
path: root/Android.bp
blob: bdddd7a91e9589b0d50e8ea6d66487029f70a0e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
package {
    default_applicable_licenses: ["external_android-clat_license"],
}

// Added automatically by a large-scale-change
//
// large-scale-change included anything that looked like it might be a license
// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
//
// Please consider removing redundant or irrelevant files from 'license_text:'.
// See: http://go/android-license-faq
license {
    name: "external_android-clat_license",
    visibility: [":__subpackages__"],
    license_kinds: [
        "SPDX-license-identifier-Apache-2.0",
    ],
    license_text: [
        "LICENSE",
        "NOTICE",
    ],
}

cc_defaults {
    name: "clatd_defaults",

    cflags: [
        "-Wall",
        "-Werror",
        "-Wunused-parameter",

        // Bug: http://b/33566695
        "-Wno-address-of-packed-member",
    ],

    // For MARK_UNSET.
    header_libs: [
        "libnetd_client_headers"
    ],
}

// Code used both by the daemon and by unit tests.
filegroup {
    name: "clatd_common",
    srcs: [
        "clatd.c",
        "dump.c",
        "getaddr.c",
        "icmp.c",
        "ipv4.c",
        "ipv6.c",
        "logging.c",
        "netlink_callbacks.c",
        "netlink_msg.c",
        "ring.c",
        "setif.c",
        "translate.c",
    ],
}

// The clat daemon.
cc_binary {
    name: "clatd",
    defaults: ["clatd_defaults"],
    srcs: [
        ":clatd_common",
        "main.c"
    ],
    static_libs: ["libnl"],
    shared_libs: [
        "libcutils",
        "liblog",
        "libnetutils",
    ],

    // Only enable clang-tidy for the daemon, not the tests, because enabling it for the
    // tests substantially increases build/compile cycle times and doesn't really provide a
    // security benefit.
    tidy: true,
    tidy_checks: [
        "-*",
        "cert-*",
        "clang-analyzer-security*",
        "android-*",
    ],
    tidy_flags: [
        "-warnings-as-errors=clang-analyzer-security*,cert-*,android-*",
    ],
    // Actually not required for clatd itself. See comments in the rc file.
    init_rc: [
        "vendor-464xlat.rc",
    ],
    sanitize: {
        memtag_heap: true,
    },
}

// Unit tests.
cc_test {
    name: "clatd_test",
    defaults: ["clatd_defaults"],
    srcs: [
        ":clatd_common",
        "clatd_test.cpp"
    ],
    static_libs: [
        "libbase",
        "libnetd_test_tun_interface",
        "libnl",
    ],
    shared_libs: [
        "libcutils",
        "liblog",
        "libnetutils",
    ],
    test_suites: ["device-tests"],
    require_root: true,
}