Commit graph

90,964 commits

Message SHA1
Merge "move bpfloader.rc into p/m/C" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2023-10-25 00:07:02 +00:00
4530eaaa9e
doc: add bpfloader rc files from previous Android releases
Stripping comments since those are not interesting
for the purposes of what these things actually do.

Doing R+ since tethering apex only supports R+ now.

Generated via:
  (cd ../../../../../system/bpf && git cat-file -p remotes/aosp/android11-release:bpfloader/bpfloader.rc; ) | egrep -v '^ *#' > bpfloader-sdk30-11-R.rc
  (cd ../../../../../system/bpf && git cat-file -p remotes/aosp/android12-release:bpfloader/bpfloader.rc; ) | egrep -v '^ *#' > bpfloader-sdk31-12-S.rc
  (cd ../../../../../system/bpf && git cat-file -p remotes/aosp/android13-release:bpfloader/bpfloader.rc; ) | egrep -v '^ *#' > bpfloader-sdk33-13-T.rc
  (cd ../../../../../system/bpf && git cat-file -p remotes/aosp/android14-release:bpfloader/bpfloader.rc; ) | egrep -v '^ *#' > bpfloader-sdk34-14-U.rc
  (cd ../../../../../system/bpf && git cat-file -p remotes/aosp/main:bpfloader/bpfloader.rc;              ) | egrep -v '^ *#' > bpfloader-sdk34-14-U-QPR2.rc

Test: N/A
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Idd8032ce66ef07a1d9e42343e75b26d764e6d8c1

Maciej Żenczykowski   commited 2023-10-24 19:26:55 +00:00
b0940279c4
Merge "[Thread] flagging Android Thread APIs" into main
Kangping Dong   authored and   Gerrit Code Review   commited 2023-10-24 14:26:06 +00:00
9513988323
[Thread] flagging Android Thread APIs
This commit declares the initial "thread_enabled" feature flag and use
this to flag all existing and future Thread system APIs with @FlaggedApi

Bug: 301473012
Test: build
Change-Id: I43f64ce38f7fd0806733b21c4f393e4563e6a467

Kangping Dong   commited 2023-10-24 19:45:04 +08:00
75aa485604
move bpfloader.rc into p/m/C
Generated via:
  cat ../../../system/bpf/bpfloader/bpfloader.rc > netbpfload/netbpfload.rc

(plus changing Android.bp to use it)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I4bcdd57b0b5abcc296a4c56273d6aac632560345

Maciej Żenczykowski   commited 2023-10-24 02:18:02 -07:00
7da54d9940
Merge changes I427360f6,Ie6dbbe22 into main
* changes:
  SyncSM05.1: add testMultiDepthTransition
  SyncSM05: add SyncStateMachineTest

Mark Chien   authored and   Gerrit Code Review   commited 2023-10-24 06:50:43 +00:00
66ef9d35ce
Merge "[BR01.1] Support BpfNetMapsReader" into main
Junyu Lai   authored and   Gerrit Code Review   commited 2023-10-24 05:56:33 +00:00
a62eed380c
Merge "Fix arg order to set-package-network-enabled in the CTS preparer" into main
Jean Chalard   authored and   Gerrit Code Review   commited 2023-10-24 05:39:55 +00:00
e7662ae724
Merge "Mock Vpn.setAlwaysOnPackage()." into main
Hansen Kurli   authored and   Gerrit Code Review   commited 2023-10-24 03:11:38 +00:00
a584159ceb
Merge "Add test for cgroup bpf program status" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2023-10-23 18:37:05 +00:00
1bd33c6c17
Merge "Revert "[BR07.1] Expose setDataSaverEnabled from ConnectivityManager"" into main
Jordan Silva   authored and   Gerrit Code Review   commited 2023-10-23 15:12:50 +00:00
118c2646f3
Revert "[BR07.1] Expose setDataSaverEnabled from ConnectivityManager"
Revert submission 2745215-npmsbpf

DroidMonitor: Potential culprit for Bug 307256512 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.


Reason for revert: 307256512

Reverted changes: /q/submissionid:2745215-npmsbpf

Change-Id: I27119a7484453d1369bbdf71ad2479edec7d664f

Jordan Silva   authored and   Gerrit Code Review   commited 2023-10-23 13:23:01 +00:00
457ae0f00f
[BR01.1] Support BpfNetMapsReader
A helper class to *read* java BpfMaps. This is designed to
provide direct bpf access in the caller process through
ConnectivityManager APIs.

The change also removes any statical link to
net-utils-device-common-struct from service-connectivity.
This is because net-utils-device-common-struct is already
included in framework-connectivity. Including it again in
service-connectivity would create a r8 build fail by circular
dependency.

Test: atest FrameworksNetTests:android.net.connectivity.com.android.server.BpfNetMapsTest
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.net.module.util.StructTest
Test: atest FrameworksNetTests:android.net.connectivity.android.net.BpfNetMapsReaderTest
Bug: 297836825
Change-Id: I7a6d2eb816d0dc7343167bddd672806b199f44fe

Junyu Lai   commited 2023-10-23 20:11:02 +08:00
626045a601
Merge changes Id9f81fdf,I3428e8b3,Ifa895f71,I61cd4751,I47a25e9f into main
* changes:
  Add tests for always on lockdown VPN on system user.
  Remove MockVpn.setAlwaysOnPackage() non-lockdown.
  Mock onUserAdded() and onUserRemoved()
  Refactor helper method to return integer ranges.
  Add tests for onUserAdded and onUserRemoved

Hansen Kurli   authored and   Gerrit Code Review   commited 2023-10-23 11:58:24 +00:00
00fd12588f
Merge "[BR07.1] Expose setDataSaverEnabled from ConnectivityManager" into main
Junyu Lai   authored and   Gerrit Code Review   commited 2023-10-23 11:21:53 +00:00
d88205a1ae
Mock Vpn.setAlwaysOnPackage().
Call setRequireVpnForUids() directly to mock an always on Vpn
being enabled instead of calling the real Vpn method.

Bug: 230548427
Test: atest FrameworksNetTests
Change-Id: I63d6547104cc6ee984413d4cf6027ceecd301ecc

Hansen Kurli   commited 2023-10-23 17:22:19 +08:00
2ddfc8ba8c
Add tests for always on lockdown VPN on system user.
Add test coverage for Vpn.setAlwaysOnPackage() where the caller
is system user to ensure uid = 0 is not restricted.

Bug: 230548427
Test: atest FrameworksNetTests
Change-Id: Id9f81fdf0147597f64f8440b971930b3bd7b55e5

Hansen Kurli   commited 2023-10-23 17:22:10 +08:00
a09c6f29a6
Fix arg order to set-package-network-enabled in the CTS preparer
Test: manual
Change-Id: Ife55ed9dc152cd2c21e56b84201b9c34dbb04d46

Chalard Jean   commited 2023-10-23 17:26:53 +09:00
a27dca2fdc
Remove MockVpn.setAlwaysOnPackage() non-lockdown.
Remove calls to MockVpn.setAlwaysOnPackage() where lockdown is
false as this does not cause any changes to occur. Also verify
setRequireVpnForUids() is not called for this case in VpnTest.

Bug: 230548427
Test: atest FrameworksNetTests
Change-Id: I3428e8b31b02975975be9e943e1f88cf0e80c5ee

Hansen Kurli   commited 2023-10-23 16:03:06 +08:00
9ae16e4e27
SyncSM05.1: add testMultiDepthTransition
Test: atest TetheringTests
Change-Id: I427360f6a106b001123442ccd4802290d4f13369

Mark   commited 2023-10-23 07:34:29 +00:00
c352f3cb4e
SyncSM05: add SyncStateMachineTest
A initial test for SyncStateMachine, will add more tests in the
following changes.

Test: atest SyncStateMachineTest
Change-Id: Ie6dbbe22bfef40b1675d50243d14d0a235df1e3a

Mark   commited 2023-10-23 07:29:09 +00:00
8f068a8a1e
Mock onUserAdded() and onUserRemoved()
Replace calls to onUserAdded() and onUserRemoved() to their
equivalent setUids() or setRequireVpnForUids() calls.

Note coverage for the calls to Vpn were added in VpnTest.

Bug: 230548427
Test: atest FrameworksNetTests
Change-Id: Ifa895f71f78bd3376216fd2759c7a5a33cd3aff1

Hansen Kurli   commited 2023-10-23 15:26:30 +08:00
cd04062150
Refactor helper method to return integer ranges.
Calls to setRequireVpnForUids() for Vpn lockdown actually uses a
List instead of a Set of integer ranges.
Add intRangesExcludingUids() to return the needed List of integer
ranges and replace relevant usages of UidRange.toIntRanges() with
it.

Bug: 230548427
Test: atest FrameworksNetTests
Change-Id: I61cd4751ce2faeb129daa5ad5da7181e3c1df73c

Hansen Kurli   commited 2023-10-23 15:12:21 +08:00
946cafb87e
Add test for cgroup bpf program status
This is useful to ensure cgroup bpf program is attached,
which would lead to hard-debugging uid stats missing problem.

Test: atest ConnectivityServiceIntegrationTest#testBpfProgramAttachStatus
Bug: 292156770
Change-Id: I16370497484aff29ed41cbb0d160e530731e1a4e

Junyu Lai   commited 2023-10-23 13:38:04 +08:00
54e84ab05a
Merge "Increase the service bind timeout." into main
Sudheer Shanka   authored and   Gerrit Code Review   commited 2023-10-22 02:16:22 +00:00
6c83f00b09
Merge "Reapply "Simplify addRoutesToLocalNetwork calls"" into main
Jean Chalard   authored and   Gerrit Code Review   commited 2023-10-21 16:25:58 +00:00
dab9125464
Merge "execute platform bpfloader after netbpfload is done" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2023-10-21 16:06:44 +00:00
1b36d2e2a3
execute platform bpfloader after netbpfload is done
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I447880763bbc506f08b578f862f09be91ab3d14d

Maciej Żenczykowski   commited 2023-10-21 09:20:03 +00:00
58c182291d
Merge "Correct LINT path on UidOwnerMatchType" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-10-21 03:22:32 +00:00
28f16f4269
Merge "move the bpf.progs_loaded = 1 setting back to bpfloader" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2023-10-21 02:18:05 +00:00
ef63fd1fa0
Correct LINT path on UidOwnerMatchType
UidOwnerMatchType Java definition moved from BpfNetMaps.java to
BpfNetMapsConstants.java in change I6d7ea044e43180.

Bug: 297836825
Test: presubmit
Change-Id: I4fc28406750cac9143ea47e9304b455ab616d462

Ken Chen   commited 2023-10-21 01:47:05 +00:00
cf25a54909
Revert "netbpfload: remove netbpfload.rc"
This mostly reverts commit 1d2c93d568.

Test: N/A
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I0d7fdaeae508c0250114f7af8700d0fc40b0f27a

Maciej Żenczykowski   commited 2023-10-21 00:15:00 +00:00
7db65c6d38
move the bpf.progs_loaded = 1 setting back to bpfloader
change of design: we'll call netbpfload before bpfloader

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I2d7a04a1bf1aa1d163f2b3936e2cde61308c4aa4

Maciej Żenczykowski   commited 2023-10-20 15:18:50 -07:00
3f25b4ba8a
Merge "Reapply "Add LocalNetworkConfig"" into main
Jean Chalard   authored and   Gerrit Code Review   commited 2023-10-20 06:25:14 +00:00
e32bf36be8
Merge "Add synchronized block when accessing global variables" into main
Junyu Lai   authored and   Gerrit Code Review   commited 2023-10-20 06:06:37 +00:00
8f6df28f50
Merge "Add method to check if IA prefix option takes 0 lifetimes." into main
Xiao Ma   authored and   Gerrit Code Review   commited 2023-10-20 05:37:26 +00:00
26af70f5fe
Merge "Support shell command to get bpf program id" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2023-10-19 22:35:04 +00:00
5c2b517d6a
Merge "tethering apex: add ethtool binary" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2023-10-19 19:53:13 +00:00
edcc9425a0
Increase the service bind timeout.
Bug: 305826147
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:4c137f7fa7827a9794165b86a5cc7ade85f017bf)
Merged-In: I1840e091ebbc9812da56a3522e009ba67a18c476
Change-Id: I1840e091ebbc9812da56a3522e009ba67a18c476

Sudheer Shanka   authored and   Android Build Cherrypicker Worker   commited 2023-10-19 19:19:51 +00:00
bbe0b27ed8
[BR07.1] Expose setDataSaverEnabled from ConnectivityManager
Currently, data saver switch is controlled in NPMS, which
calls into NetworkManagementService and netd when switching
status. In netd, BandwidthController manipulates the
bw_data_saver chain to control the overall behavior.

However, this code are all platform implementation, which
are not updatable. In order to migrate data saver switch
from iptables to bpf, this API is needed for Connectivity to
change the implementation to directly write bpf in later
patches.

Test: atest CtsHostsideNetworkTests:com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Test: atest FrameworksServicesTests:NetworkManagementServiceTest
Bug: 297836825
Change-Id: I71fa41ca739fef8e191fba91b02758ad5f732d5c

Junyu Lai   commited 2023-10-19 17:43:44 +08:00
c279f1830e
Merge "Dump bpf program status in dumpsys" into main
Junyu Lai   authored and   Gerrit Code Review   commited 2023-10-19 09:33:27 +00:00
eb75416136
Merge "Respect SkipPresubmit annotation for ConnectivityCoverageTests" into main
Junyu Lai   authored and   Gerrit Code Review   commited 2023-10-19 06:58:40 +00:00
6809bbde8e
Merge "Add expired services removal flag" into main
Paul Hu   authored and   Gerrit Code Review   commited 2023-10-19 06:19:43 +00:00
322a322687
Respect SkipPresubmit annotation for ConnectivityCoverageTests
Follow-up from aosp/2788197, the CL does not work since
SkipPresubmit annotation is not excluded from TEST_MAPPING for
ConnectivityCoverageTests.

Test: TH
Bug: 302325928
Change-Id: Ibfa509aadc9e54da14738714be46abd25f46f3fb

Junyu Lai   commited 2023-10-19 10:33:03 +08:00
08a4a873b8
Add expired services removal flag
The TTL check and removal of expired services is currently only
performed when a mDNS query is sent. This can result in expired
services remaining in the cache if no queries are sent. To
address this, the remaining TTL will be checked when retrieving
services from the MdnsServiceCache. Add a new flag to enable
the expired services removal feature. This feature will be
implemented in subsequent changes.

Bug: 265787401
Bug: 304649384
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I30f0eea568ee45d363cc02821de0921d6040f981

Paul Hu   commited 2023-10-18 17:48:46 +08:00
f3fe3333d3
Support shell command to get bpf program id
Test: atest NetworkStatsIntegrationTest#testBpfProgramAttachStatus
Bug: 292156770

Change-Id: I815be0f3f3592442939872f98e3ad9d224a6aeb6

Junyu Lai   commited 2023-10-18 16:06:15 +08:00
452e464ee9
Dump bpf program status in dumpsys
Sample output:
Bpf Program Status:
  CGROUP_INET_INGRESS: 21
  CGROUP_INET_EGRESS: 22
  CGROUP_INET_SOCK_CREATE: 28
  CGROUP_INET4_BIND: 30
  CGROUP_INET6_BIND: 31

Test: adb shell dumpsys connectivity
Test: atest FrameworksNetTests:android.net.connectivity.com.android.server.ConnectivityServiceTest#testDumpDoesNotCrash
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.ConnectivityServiceTest#testDumpDoesNotCrash
Bug: 292156770
Change-Id: I312c90c524af12d093536156d6d5c6febd64305a

Junyu Lai   commited 2023-10-18 16:05:55 +08:00
155760b57b
Reapply "Simplify addRoutesToLocalNetwork calls"
This reverts commit 316346be6e.

Change-Id: I86977f6e7a5451d037c7ea6fee5c4bc7082935ff

Chalard Jean   commited 2023-10-18 15:50:02 +09:00
7f2b3dabcd
Reapply "Add LocalNetworkConfig"
This reverts commit 6eea22b18c.

Change-Id: I0a2cef4ee992577674c92ecd384dc6f4361afa02

Chalard Jean   commited 2023-10-18 15:50:02 +09:00
f9d0e3e94f
Merge "Respect SkipPresubmit annotation for ConnectivityCoverageTests" into main
Junyu Lai   authored and   Gerrit Code Review   commited 2023-10-18 05:16:13 +00:00
8cefcdc1b2