From e3ea09c60fdc7be99589299d12291d9f124d3f0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Wed, 15 Jun 2022 01:04:03 -0700 Subject: move XtBpfProgLocations.h into a new header library MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: 235778483 Test: TreeHugger Signed-off-by: Maciej Żenczykowski Change-Id: I6ad0a12ff14331809cbca97043bc5d5c9f8742b8 (cherry picked from commit d9fc54b55b58ef20dbd34e12699ae947912e7562) Merged-In: I6ad0a12ff14331809cbca97043bc5d5c9f8742b8 --- Android.bp | 9 ++++++++ include/binder_utils/XtBpfProgLocations.h | 37 ------------------------------- include/mainline/XtBpfProgLocations.h | 37 +++++++++++++++++++++++++++++++ server/BandwidthControllerTest.cpp | 2 +- server/TetherController.h | 2 +- 5 files changed, 48 insertions(+), 39 deletions(-) delete mode 100644 include/binder_utils/XtBpfProgLocations.h create mode 100644 include/mainline/XtBpfProgLocations.h diff --git a/Android.bp b/Android.bp index e08494e8..b654f76b 100644 --- a/Android.bp +++ b/Android.bp @@ -29,6 +29,15 @@ cc_library_headers { apex_available: [ "//apex_available:platform", "com.android.resolv", + ], + min_sdk_version: "29", +} + +cc_library_headers { + name: "netd_mainline_headers", + export_include_dirs: ["include/mainline"], + apex_available: [ + "//apex_available:platform", "com.android.tethering", ], sdk_version: "29", diff --git a/include/binder_utils/XtBpfProgLocations.h b/include/binder_utils/XtBpfProgLocations.h deleted file mode 100644 index 95a5742c..00000000 --- a/include/binder_utils/XtBpfProgLocations.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -/* -=-=-=-=-= WARNING -=-=-=-=-=- - * - * DO *NOT* *EVER* CHANGE THESE - they *MUST* match what the Tethering mainline module provides! - * - * You cannot even change them in sync, since newer module must work on older Android T releases. - * - * You could with difficulty, uprevs of the bpfloader, api detection logic in mainline, etc, - * change this in Android U or later, but even that is a very bad idea and not worth the hassle. - * - * - * Mainline Tethering module on T+ is expected to make available to netd (for use by - * BandwidthController iptables initialization code) four xt_bpf programs at the following - * locations: - */ -#define XT_BPF_NETD(NAME) "/sys/fs/bpf/netd_shared/prog_netd_skfilter_" NAME "_xtbpf" -#define XT_BPF_ALLOWLIST_PROG_PATH XT_BPF_NETD("allowlist") -#define XT_BPF_DENYLIST_PROG_PATH XT_BPF_NETD("denylist") -#define XT_BPF_EGRESS_PROG_PATH XT_BPF_NETD("egress") -#define XT_BPF_INGRESS_PROG_PATH XT_BPF_NETD("ingress") diff --git a/include/mainline/XtBpfProgLocations.h b/include/mainline/XtBpfProgLocations.h new file mode 100644 index 00000000..95a5742c --- /dev/null +++ b/include/mainline/XtBpfProgLocations.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +/* -=-=-=-=-= WARNING -=-=-=-=-=- + * + * DO *NOT* *EVER* CHANGE THESE - they *MUST* match what the Tethering mainline module provides! + * + * You cannot even change them in sync, since newer module must work on older Android T releases. + * + * You could with difficulty, uprevs of the bpfloader, api detection logic in mainline, etc, + * change this in Android U or later, but even that is a very bad idea and not worth the hassle. + * + * + * Mainline Tethering module on T+ is expected to make available to netd (for use by + * BandwidthController iptables initialization code) four xt_bpf programs at the following + * locations: + */ +#define XT_BPF_NETD(NAME) "/sys/fs/bpf/netd_shared/prog_netd_skfilter_" NAME "_xtbpf" +#define XT_BPF_ALLOWLIST_PROG_PATH XT_BPF_NETD("allowlist") +#define XT_BPF_DENYLIST_PROG_PATH XT_BPF_NETD("denylist") +#define XT_BPF_EGRESS_PROG_PATH XT_BPF_NETD("egress") +#define XT_BPF_INGRESS_PROG_PATH XT_BPF_NETD("ingress") diff --git a/server/BandwidthControllerTest.cpp b/server/BandwidthControllerTest.cpp index bf4c2e2a..844681d0 100644 --- a/server/BandwidthControllerTest.cpp +++ b/server/BandwidthControllerTest.cpp @@ -34,7 +34,7 @@ #include "BandwidthController.h" #include "Fwmark.h" #include "IptablesBaseTest.h" -#include "binder_utils/XtBpfProgLocations.h" +#include "mainline/XtBpfProgLocations.h" #include "tun_interface.h" using ::testing::_; diff --git a/server/TetherController.h b/server/TetherController.h index bbabcee4..d2195f23 100644 --- a/server/TetherController.h +++ b/server/TetherController.h @@ -31,7 +31,7 @@ #include "android/net/TetherOffloadRuleParcel.h" -#include "binder_utils/XtBpfProgLocations.h" +#include "mainline/XtBpfProgLocations.h" namespace android { namespace net { -- cgit v1.2.3