• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 // The resulting .o needs to load on Android S+
18 #define BPFLOADER_MIN_VER BPFLOADER_MAINLINE_S_VERSION
19 
20 // This is non production code, only used for testing
21 // Needed because the bitmap array definition is non-kosher for pre-T OS devices.
22 #define THIS_BPF_PROGRAM_IS_FOR_TEST_PURPOSES_ONLY
23 
24 #include "bpf_net_helpers.h"
25 #include "offload.h"
26 
27 // Used only by TetheringPrivilegedTests, not by production code.
28 DEFINE_BPF_MAP_GRW(tether_downstream6_map, HASH, TetherDownstream6Key, Tether6Value, 16,
29                    AID_NETWORK_STACK)
30 DEFINE_BPF_MAP_GRW(tether2_downstream6_map, HASH, TetherDownstream6Key, Tether6Value, 16,
31                    AID_NETWORK_STACK)
32 DEFINE_BPF_MAP_GRW(tether3_downstream6_map, HASH, TetherDownstream6Key, Tether6Value, 16,
33                    AID_NETWORK_STACK)
34 // Used only by BpfBitmapTest, not by production code.
35 DEFINE_BPF_MAP_GRW(bitmap, ARRAY, int, uint64_t, 2, AID_NETWORK_STACK)
36 
37 // we need at least 1 bpf program in the final .o for Android S bpfloader compatibility
38 // this program is trivial, and has a 'infinite' minimum kernel version number,
39 // so will always be skipped
40 DEFINE_BPF_PROG_KVER("skfilter/match", AID_ROOT, AID_ROOT, match, KVER_INF)
41 (__unused struct __sk_buff* skb) {
42     return XTBPF_MATCH;
43 }
44 
45 LICENSE("Apache 2.0");
46 CRITICAL("Networking xTS tests");
47