blob: 4dba6b987841f482b803f257d2c4e78eec6c322b [file] [log] [blame]
Maciej Żenczykowskie9810ff2021-01-14 20:02:08 -08001/*
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
Maciej Żenczykowski0b477492025-03-04 22:12:42 -080017// The resulting .o needs to load on Android S+
18#define BPFLOADER_MIN_VER BPFLOADER_MAINLINE_S_VERSION
Maciej Żenczykowskia457bf72021-10-22 21:41:25 -070019
Maciej Żenczykowskic8e40c12022-10-21 00:01:39 +000020// 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
Maciej Żenczykowskie9810ff2021-01-14 20:02:08 -080024#include "bpf_net_helpers.h"
Maciej Żenczykowski4e3321e2022-12-08 12:59:23 +000025#include "offload.h"
Maciej Żenczykowskie9810ff2021-01-14 20:02:08 -080026
27// Used only by TetheringPrivilegedTests, not by production code.
Maciej Żenczykowski7dfbcf52021-01-26 16:08:57 -080028DEFINE_BPF_MAP_GRW(tether_downstream6_map, HASH, TetherDownstream6Key, Tether6Value, 16,
Maciej Żenczykowski1edfbf82024-08-16 18:08:09 -070029 AID_NETWORK_STACK)
Maciej Żenczykowski45e93722024-06-15 11:47:26 -070030DEFINE_BPF_MAP_GRW(tether2_downstream6_map, HASH, TetherDownstream6Key, Tether6Value, 16,
Maciej Żenczykowski1edfbf82024-08-16 18:08:09 -070031 AID_NETWORK_STACK)
Maciej Żenczykowski878aae02024-06-15 11:54:36 -070032DEFINE_BPF_MAP_GRW(tether3_downstream6_map, HASH, TetherDownstream6Key, Tether6Value, 16,
Maciej Żenczykowski1edfbf82024-08-16 18:08:09 -070033 AID_NETWORK_STACK)
Tyler Wearc23ffbd2021-12-01 16:25:00 -080034// Used only by BpfBitmapTest, not by production code.
Maciej Żenczykowski1edfbf82024-08-16 18:08:09 -070035DEFINE_BPF_MAP_GRW(bitmap, ARRAY, int, uint64_t, 2, AID_NETWORK_STACK)
Maciej Żenczykowskie9810ff2021-01-14 20:02:08 -080036
Maciej Żenczykowski9ba9c1d2024-09-05 09:10:51 -070037// 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
40DEFINE_BPF_PROG_KVER("skfilter/match", AID_ROOT, AID_ROOT, match, KVER_INF)
41(__unused struct __sk_buff* skb) {
42 return XTBPF_MATCH;
Maciej Żenczykowski8c7cd342021-01-18 00:02:19 -080043}
44
Maciej Żenczykowskie9810ff2021-01-14 20:02:08 -080045LICENSE("Apache 2.0");
Maciej Żenczykowskibf159182024-09-05 09:13:49 -070046CRITICAL("Networking xTS tests");