-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: sync with latest sources of TrebleDroid
- Loading branch information
Showing
11 changed files
with
130 additions
and
10 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...ages_modules_Connectivity/0001-Allow-failing-to-load-bpf-programs-for-BPF-less-devi.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From a2f2687466c12866b247a17b51f2772a49fb8946 Mon Sep 17 00:00:00 2001 | ||
From: Pierre-Hugues Husson <[email protected]> | ||
Date: Wed, 26 Oct 2022 18:10:04 -0400 | ||
Subject: [PATCH 01/10] Allow failing to load bpf programs, for BPF-less | ||
Subject: [PATCH 01/11] Allow failing to load bpf programs, for BPF-less | ||
devices | ||
|
||
Change-Id: I68ba3be2e15c188e56e32a6ecf844e1ca64d560f | ||
|
2 changes: 1 addition & 1 deletion
2
...kages_modules_Connectivity/0002-Support-non-working-BPF-maps-on-old-BPF-less-kernel.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 78c05bd0d6c25a47a1c3605fde8dffe2c82889c2 Mon Sep 17 00:00:00 2001 | ||
From: Pierre-Hugues Husson <[email protected]> | ||
Date: Wed, 26 Oct 2022 18:11:10 -0400 | ||
Subject: [PATCH 02/10] Support non-working BPF maps on old BPF-less kernel | ||
Subject: [PATCH 02/11] Support non-working BPF maps on old BPF-less kernel | ||
|
||
--- | ||
.../src/android/net/BpfNetMapsReader.java | 13 ++++++-- | ||
|
2 changes: 1 addition & 1 deletion
2
...packages_modules_Connectivity/0003-Bring-back-traffic-indicators-for-legacy-devices.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 21a34d0c0211b22ba3c9891415e98da477d0d682 Mon Sep 17 00:00:00 2001 | ||
From: koron393 <[email protected]> | ||
Date: Fri, 20 Jan 2023 05:41:13 +0900 | ||
Subject: [PATCH 03/10] Bring back traffic indicators for legacy devices | ||
Subject: [PATCH 03/11] Bring back traffic indicators for legacy devices | ||
|
||
Revert: "remove qtaguid parsing" | ||
(commit 0b99c46bcde8e607d9233c474035da95ab68a6fe.) | ||
|
2 changes: 1 addition & 1 deletion
2
...ages_modules_Connectivity/0004-Revert-drop-support-for-V-gsi-on-pixel-5-R-base-kern.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 81c2d36e8ed282b0244cf91d8121c9bc9a4f4d3e Mon Sep 17 00:00:00 2001 | ||
From: Peter Cai <[email protected]> | ||
Date: Sat, 16 Mar 2024 15:27:27 -0400 | ||
Subject: [PATCH 04/10] Revert "drop support for V gsi on pixel 5 R base | ||
Subject: [PATCH 04/11] Revert "drop support for V gsi on pixel 5 R base | ||
kernel" | ||
|
||
This reverts commit bbbd18a71368a80f689b924dcf82062c2ee351b2. | ||
|
2 changes: 1 addition & 1 deletion
2
...rm_packages_modules_Connectivity/0005-netbpfload-add-back-support-for-4.9-T-kernels.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 2303bf88ed1b4c24672b7b1e51aefbcf1becdd38 Mon Sep 17 00:00:00 2001 | ||
From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= <[email protected]> | ||
Date: Mon, 11 Mar 2024 12:40:06 +0000 | ||
Subject: [PATCH 05/10] netbpfload: add back support for 4.9-T kernels | ||
Subject: [PATCH 05/11] netbpfload: add back support for 4.9-T kernels | ||
MIME-Version: 1.0 | ||
Content-Type: text/plain; charset=UTF-8 | ||
Content-Transfer-Encoding: 8bit | ||
|
2 changes: 1 addition & 1 deletion
2
...ebledroid/platform_packages_modules_Connectivity/0006-NetBpfLoad-more-4.9-T-support.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 933e250f2f9561cb831b77733cf0c186caf4a66f Mon Sep 17 00:00:00 2001 | ||
From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= <[email protected]> | ||
Date: Fri, 15 Mar 2024 19:03:13 +0000 | ||
Subject: [PATCH 06/10] NetBpfLoad: more 4.9-T support | ||
Subject: [PATCH 06/11] NetBpfLoad: more 4.9-T support | ||
MIME-Version: 1.0 | ||
Content-Type: text/plain; charset=UTF-8 | ||
Content-Transfer-Encoding: 8bit | ||
|
2 changes: 1 addition & 1 deletion
2
...ledroid/platform_packages_modules_Connectivity/0007-netbpfload-Support-4.14-kernels.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 7b5b0b7cf8f587bfa508d328e9c1a109688ca6a1 Mon Sep 17 00:00:00 2001 | ||
From: Michael Bestas <[email protected]> | ||
Date: Mon, 11 Mar 2024 01:52:21 +0200 | ||
Subject: [PATCH 07/10] netbpfload: Support <4.14 kernels | ||
Subject: [PATCH 07/11] netbpfload: Support <4.14 kernels | ||
|
||
Change-Id: I3d6573c102c1d64a64209bf61ecb8ed0c4ecb64c | ||
--- | ||
|
2 changes: 1 addition & 1 deletion
2
...id/platform_packages_modules_Connectivity/0008-netd-Remove-4.14-kernel-restrictions.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 4ac6d660bb9172f3584f3893d49a4aff9a3c4b3f Mon Sep 17 00:00:00 2001 | ||
From: Michael Bestas <[email protected]> | ||
Date: Fri, 15 Mar 2024 14:59:21 +0200 | ||
Subject: [PATCH 08/10] netd: Remove <4.14 kernel restrictions | ||
Subject: [PATCH 08/11] netd: Remove <4.14 kernel restrictions | ||
|
||
Change-Id: I4d4abbacd6b9589260de06663e2143bc37d8ea0f | ||
--- | ||
|
2 changes: 1 addition & 1 deletion
2
...ages_modules_Connectivity/0009-Remove-sdk-level-check-when-calling-getDataSaverEnab.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 428f8a3d1640b5f1a9c74ab5cd18eeaaceb0a1d0 Mon Sep 17 00:00:00 2001 | ||
From: Junyu Lai <[email protected]> | ||
Date: Mon, 18 Dec 2023 16:13:12 +0800 | ||
Subject: [PATCH 09/10] Remove sdk level check when calling getDataSaverEnabled | ||
Subject: [PATCH 09/11] Remove sdk level check when calling getDataSaverEnabled | ||
|
||
Follow-up from aosp/2856948, the data saver status value is | ||
filled by ConnectivityService before Android V. Thus, calling | ||
|
2 changes: 1 addition & 1 deletion
2
...ages_modules_Connectivity/0010-More-bpf-errors-ignore-there-are-some-4.14-without-t.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From c4834801bbbc52882dc15951b0e1773873fd69d5 Mon Sep 17 00:00:00 2001 | ||
From: Pierre-Hugues Husson <[email protected]> | ||
Date: Wed, 15 May 2024 05:56:59 -0400 | ||
Subject: [PATCH 10/10] More bpf errors ignore -- there are some 4.14 without | ||
Subject: [PATCH 10/11] More bpf errors ignore -- there are some 4.14 without | ||
the bpf jit file | ||
|
||
--- | ||
|
120 changes: 120 additions & 0 deletions
120
...ages_modules_Connectivity/0011-Fixup-Support-non-working-BPF-maps-on-old-BPF-less-k.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
From e47def17699ce64f2ebf0f7a928f3f91ff0cd7f4 Mon Sep 17 00:00:00 2001 | ||
From: Andy CrossGate Yan <[email protected]> | ||
Date: Sun, 26 May 2024 12:15:41 +0800 | ||
Subject: [PATCH 11/11] Fixup! Support non-working BPF maps on old BPF-less | ||
kernel | ||
|
||
Null-check all other BPF map usages, which could be used by e.g. internet restriction in LOS | ||
--- | ||
.../src/com/android/server/BpfNetMaps.java | 25 +++++++++++++++++++ | ||
1 file changed, 25 insertions(+) | ||
|
||
diff --git a/service/src/com/android/server/BpfNetMaps.java b/service/src/com/android/server/BpfNetMaps.java | ||
index 9b2202b295..ec1d1abfbc 100644 | ||
--- a/service/src/com/android/server/BpfNetMaps.java | ||
+++ b/service/src/com/android/server/BpfNetMaps.java | ||
@@ -381,6 +381,8 @@ public class BpfNetMaps { | ||
} | ||
|
||
private void removeRule(final int uid, final long match, final String caller) { | ||
+ if (sUidOwnerMap == null) return; | ||
+ | ||
try { | ||
synchronized (sUidOwnerMap) { | ||
final UidOwnerValue oldMatch = sUidOwnerMap.getValue(new S32(uid)); | ||
@@ -408,6 +410,8 @@ public class BpfNetMaps { | ||
} | ||
|
||
private void addRule(final int uid, final long match, final int iif, final String caller) { | ||
+ if (sUidOwnerMap == null) return; | ||
+ | ||
if (match != IIF_MATCH && iif != 0) { | ||
throw new ServiceSpecificException(EINVAL, | ||
"Non-interface match must have zero interface index"); | ||
@@ -510,6 +514,8 @@ public class BpfNetMaps { | ||
public void setChildChain(final int childChain, final boolean enable) { | ||
throwIfPreT("setChildChain is not available on pre-T devices"); | ||
|
||
+ if (sConfigurationMap == null) return; | ||
+ | ||
final long match = getMatchByFirewallChain(childChain); | ||
try { | ||
synchronized (sUidRulesConfigBpfMapLock) { | ||
@@ -562,6 +568,8 @@ public class BpfNetMaps { | ||
public void replaceUidChain(final int chain, final int[] uids) { | ||
throwIfPreT("replaceUidChain is not available on pre-T devices"); | ||
|
||
+ if (sUidOwnerMap == null) return; | ||
+ | ||
final long match; | ||
try { | ||
match = getMatchByFirewallChain(chain); | ||
@@ -642,6 +650,9 @@ public class BpfNetMaps { | ||
private Set<Integer> getUidsMatchEnabled(final int childChain) throws ErrnoException { | ||
final long match = getMatchByFirewallChain(childChain); | ||
Set<Integer> uids = new ArraySet<>(); | ||
+ | ||
+ if (sUidOwnerMap == null) return uids; | ||
+ | ||
synchronized (sUidOwnerMap) { | ||
sUidOwnerMap.forEach((uid, val) -> { | ||
if (val == null) { | ||
@@ -876,6 +887,8 @@ public class BpfNetMaps { | ||
public void setDataSaverEnabled(boolean enable) { | ||
throwIfPreT("setDataSaverEnabled is not available on pre-T devices"); | ||
|
||
+ if (sDataSaverEnabledMap == null) return; | ||
+ | ||
try { | ||
final short config = enable ? DATA_SAVER_ENABLED : DATA_SAVER_DISABLED; | ||
sDataSaverEnabledMap.updateEntry(DATA_SAVER_ENABLED_KEY, new U8(config)); | ||
@@ -894,6 +907,9 @@ public class BpfNetMaps { | ||
@RequiresApi(Build.VERSION_CODES.TIRAMISU) | ||
public void setIngressDiscardRule(final InetAddress address, final String iface) { | ||
throwIfPreT("setIngressDiscardRule is not available on pre-T devices"); | ||
+ | ||
+ if (sIngressDiscardMap == null) return; | ||
+ | ||
final int ifIndex = mDeps.getIfIndex(iface); | ||
if (ifIndex == 0) { | ||
Log.e(TAG, "Failed to get if index, skip setting ingress discard rule for " + address | ||
@@ -917,6 +933,9 @@ public class BpfNetMaps { | ||
@RequiresApi(Build.VERSION_CODES.TIRAMISU) | ||
public void removeIngressDiscardRule(final InetAddress address) { | ||
throwIfPreT("removeIngressDiscardRule is not available on pre-T devices"); | ||
+ | ||
+ if (sIngressDiscardMap == null) return; | ||
+ | ||
try { | ||
sIngressDiscardMap.deleteEntry(new IngressDiscardKey(address)); | ||
} catch (ErrnoException e) { | ||
@@ -989,6 +1008,8 @@ public class BpfNetMaps { | ||
} | ||
|
||
private void dumpOwnerMatchConfig(final IndentingPrintWriter pw) { | ||
+ if (sConfigurationMap == null) return; | ||
+ | ||
try { | ||
final long match = sConfigurationMap.getValue(UID_RULES_CONFIGURATION_KEY).val; | ||
pw.println("current ownerMatch configuration: " + match + " " + matchToString(match)); | ||
@@ -998,6 +1019,8 @@ public class BpfNetMaps { | ||
} | ||
|
||
private void dumpCurrentStatsMapConfig(final IndentingPrintWriter pw) { | ||
+ if (sConfigurationMap == null) return; | ||
+ | ||
try { | ||
final long config = sConfigurationMap.getValue(CURRENT_STATS_MAP_CONFIGURATION_KEY).val; | ||
final String currentStatsMap = | ||
@@ -1009,6 +1032,8 @@ public class BpfNetMaps { | ||
} | ||
|
||
private void dumpDataSaverConfig(final IndentingPrintWriter pw) { | ||
+ if (sDataSaverEnabledMap == null) return; | ||
+ | ||
try { | ||
final short config = sDataSaverEnabledMap.getValue(DATA_SAVER_ENABLED_KEY).val; | ||
// Any non-zero value converted from short to boolean is true by convention. | ||
-- | ||
2.34.1 | ||
|