Commit graph

111,702 commits

Message SHA1
Merge "Create CommonConnectivityJni to share between modules" into main
Patrick Rohr   authored and   Android (Google) Code Review   commited 2025-07-24 09:56:39 -07:00
0e5defc1e9
Merge "NetBpfLoad: Add method to prepare program load by libbpf" into main
Motomu Utsumi   authored and   Android (Google) Code Review   commited 2025-07-24 01:53:02 -07:00
d8ec55621a
Merge changes I74bb7895,Ib79e90f8,I4e66c712 into main
* changes:
  NetBpfLoad: Add method to prepare map load by libbpf
  NetBpfLoad: Extract building prog pin loc to a helper function
  NetBpfLoad: Extract building map pin loc to a helper function

Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-07-24 00:45:20 -07:00
7e86ed2fb1
Merge "NetBpfLoad: Add program name to struct codeSection." into main
Maciej Żenczykowski   authored and   Android (Google) Code Review   commited 2025-07-23 23:09:12 -07:00
4fa9057b39
NetBpfLoad: Add method to prepare program load by libbpf
Bug: 428792764
Flag: EXEMPT no-op
Test: TH
Change-Id: Ia3666e4cd17100a5fd96a0d9da2b377f8fe9a26d

Motomu Utsumi   commited 2025-07-24 13:57:50 +09:00
3cdcc47382
NetBpfLoad: Add method to prepare map load by libbpf
Bug: 428792764
Flag: EXEMPT no-op
Test: TH
Change-Id: I74bb7895756df19be0d095269a490d3da54787bd

Motomu Utsumi   commited 2025-07-24 13:57:50 +09:00
f1b1afb341
NetBpfLoad: Extract building prog pin loc to a helper function
Bug: 428792764
Flag: EXEMPT no-op
Test: TH
Change-Id: Ib79e90f81fcfeb7767850a49b9f8bd7b9e475647

Motomu Utsumi   commited 2025-07-24 13:57:35 +09:00
f8977e924d
NetBpfLoad: Extract building map pin loc to a helper function
Bug: 428792764
Flag: EXEMPT no-op
Test: TH
Change-Id: I4e66c7127f210a2264b370e079c1fb7b44958886

Motomu Utsumi   commited 2025-07-24 13:08:34 +09:00
bf407f6bc4
Merge changes I44b4c22c,I5777b2a7 into main
* changes:
  Add EthernetManagerTests for NCM-only interfaces
  Add missing assumeNoInterfaceForTetheringAvailable

Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-07-23 16:47:40 -07:00
be5bf33802
Merge changes I12e4d492,I4c787e9c,I52a36ebb into main
* changes:
  Add support for TestInterfaceMode to EthernetTracker
  Move call to setEthernetEnabled inside setIncludeTestInterfaces
  Add support for TestInterfaceMode in setIncludeTestInterfaces

Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-07-23 14:16:42 -07:00
23ce59740a
Add EthernetManagerTests for NCM-only interfaces
Test: TH
Flag: EXEMPT mainline
Change-Id: I44b4c22cedc8a11cd5ac9d8949360b6d630678af

Patrick Rohr   commited 2025-07-23 12:39:35 -07:00
15d17c134a
Add missing assumeNoInterfaceForTetheringAvailable
Otherwise, if an ethernet network is connected via NCM during the test,
the request for a local-only NCM network will bring down global
connectivity and might break the test.

Test: TH
Flag: EXEMPT mainline
Change-Id: I5777b2a7658566348de7a346e0b394f10fdb0dd4

Patrick Rohr   commited 2025-07-23 11:57:54 -07:00
709beb6cf9
Add support for TestInterfaceMode to EthernetTracker
This change passes TestInterfaceMode into EthernetTracker.

It also introduces a small change to isValidTestInterface (so it
consistently returns true / false independent of whether test interfaces
are currently included).

This seems more consistent. Also note that a device is already
effectively prevented from configuring "testtap" interfaces by itself as
otherwise EthernetManagerTest (and various other tests relying on tap
interfaces) would break.

Test: atest EthernetManagerTest
Flag: EXEMPT mainline
Change-Id: I12e4d492d7c00d049ca44663c361c12c4262c7bc

Patrick Rohr   commited 2025-07-23 11:21:22 -07:00
3b8377fbc7
Move call to setEthernetEnabled inside setIncludeTestInterfaces
setIncludeTestInterfaces() pretty much always requires a call to
setEthernetEnabled(currentState) afterwards as a synchronization
mechanism. Add this call directly inside the helper function for
simplicity.

Test: TH
Flag: EXEMPT mainline
Change-Id: I4c787e9c560ffe60c981ac2e2a730e96138707cb

Patrick Rohr   commited 2025-07-23 10:55:07 -07:00
e9d1d080db
Add support for TestInterfaceMode in setIncludeTestInterfaces
This will allow EthernetManagerTest to include test interfaces as
NCM-only interfaces.

Note that at this point, setting any TEST_INTERFACE_MODE includes a
test interface in both MODE_ETHERNET and MODE_NCM (equivalent to
setIncludeTestInterface(true)) as the mode is not propagated further
than EthernetServiceImpl.

Test: TH
Flag: EXEMPT mainline
Change-Id: I52a36ebb29bc27a21c7521c1cd9bd186001ac6c5

Patrick Rohr   commited 2025-07-23 10:00:51 -07:00
6822c19294
Create CommonConnectivityJni to share between modules
Flag: EXEMPT mainline
Test: TH
Change-Id: Ia85dfd3d979803baca9e971d1083f54dff46de53

Jimi Chen   commited 2025-07-23 05:47:12 +00:00
e5a4e6b0ba
Merge "Fix lambda returning set instead of boolean" into main
Jimi Chen   authored and   Android (Google) Code Review   commited 2025-07-22 20:54:06 -07:00
3d53f902a9
NetBpfLoad: Add program name to struct codeSection.
Bug: 428792764
Flag: EXEMPT no-op
Test: TH
Change-Id: I3820e2464337778d7597cc4e1842fd0d8eb11045

Motomu Utsumi   commited 2025-07-23 12:04:50 +09:00
8645b6e0dc
Merge "Add EthernetPortSelector class" into main
Chuwei He   authored and   Android (Google) Code Review   commited 2025-07-22 18:14:21 -07:00
fbef6e47d7
Merge "NetBpfLoad: rename 'writeProcSysFile()' to 'writeFile()'" into main
Maciej Żenczykowski   authored and   Android (Google) Code Review   commited 2025-07-22 15:52:37 -07:00
21e92fabe8
NetBpfLoad: rename 'writeProcSysFile()' to 'writeFile()'
The function doesn't enforce anything specific to /proc/sys.
The name should reflect that.

(prep work for reusing this for other purposes - incl. selinux booleans)

Test: TreeHugger
Flag: EXEMPT mainline/no-op
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ia206c19043e63e274c7370739750e1a8236e4127

Maciej Żenczykowski   commited 2025-07-22 12:32:08 -07:00
c9b0a8396a
NetBpfLoad: don't set kern_version
Kernel uapi documents this field as unused.

libbpf sets this to 8+8+8 bits, while we do 8+8+16 bits
(to support kernels x.x.>255)

This causes crazy strace output...

Let's just remove it entirely.

Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie67f5a4b479d4555a593a4e6d8d14ff82efce98f

Maciej Żenczykowski   commited 2025-07-22 12:28:08 -07:00
86f5ee3c5e
Add EthernetPortSelector class
This patch added EthernetPortSelector class that is used to select a
specific ethernet port by interface name or MAC address.

Bug: 397536853
Test: atest ConnectivityCoverageTests
Flag: EXEMPT mainline
Change-Id: I050dc1f484115fdedda349cc2e1a44f4c5fda6db

Chuwei He   commited 2025-07-22 04:52:05 -07:00
66fef2ea8e
Merge "Don't perform entitlement checks on invalid subscription IDs" into main
Yuyang Huang   authored and   Android (Google) Code Review   commited 2025-07-22 03:23:59 -07:00
d41be76558
Fix lambda returning set instead of boolean
The `expect_with_retry` utility expects the lambda to return a
boolean value. However, the previous implementation wrapped the
comparison result `apf_utils.get_matched_packet_counts(...) == 1`
inside a set `{...}`.

This caused the lambda to return a set (e.g., `{True}` or `{False}`),
which is truthy if non-empty, but not the actual boolean result.
This commit removes the unnecessary set wrapper, ensuring the lambda
directly returns the boolean outcome of the packet count comparison

Flag: EXEMPT test only
Bug: 419427388
Test: atest CtsConnectivityMultiDevicesTestCases:ApfV6Test
Change-Id: Idd77d905e5be7933b3213df5cb772773286becfa

Jimi Chen   commited 2025-07-22 08:47:03 +00:00
7e922cf917
Don't perform entitlement checks on invalid subscription IDs
Bug: 414252282
Test: TH
Flag: EXEMPT bugfix
Change-Id: I9bd208cf9e59bcfad03108c85dd7bfeb10aeff56

Chalard Jean   authored and   Yuyang Huang   commited 2025-07-22 12:27:16 +09:00
bf34d61b8d
Merge "Increase retry interval for APF packet count assertion" into main
Jimi Chen   authored and   Android (Google) Code Review   commited 2025-07-21 18:38:56 -07:00
38c329d847
Increase retry interval for APF packet count assertion
Adds `retry_interval_sec` to the packet count assertion in `ApfTestBase`.
This addresses intermittent test flakiness by allowing more time for the
server device to capture offloaded packets.

Flag: EXEMPT test only
Bug: 419427388
Test: atest CtsConnectivityMultiDevicesTestCases:ApfV6Test --iteration 10
Change-Id: Ia0ac83a7054c6a606f300546306fef1b8fccd701

Jimi Chen   commited 2025-07-21 07:27:43 +00:00
ab0cdd8fce
Merge changes Ibb1f1ea1,I1007f4f3,I51c25918,Iedfc8f39,I4124756f, ... into main
* changes:
  NetBpfLoad: Extract map type sanitization into a helper function
  NetBpfLoad: Extract prog validation into a helper function
  NetBpfLoad: Extract prog pinning logic into a helper function
  NetBpfLoad: Move selinux_context logging for prog
  NetBpfLoad: Extract map pinning logic into a helper function
  NetBpfLoad: Move selinux_context logging for map
  NetBpfLoad: Add libbpf-style map definitions for libbpf support
  NetBpfLoad: Update map helpers to support libbpf
  NetBpfLoad: Remove unnecessary reuse flag in map creation

Maciej Żenczykowski   authored and   Android (Google) Code Review   commited 2025-07-19 03:38:33 -07:00
7b0dad160b
Merge "Use Log.e for procfs file read errors" into main
Jimi Chen   authored and   Android (Google) Code Review   commited 2025-07-18 01:09:45 -07:00
4e4f2e6da6
Use Log.e for procfs file read errors
Log.wtf implies a catastrophic, unrecoverable failure. Failures to read
procfs files (e.g., due to permissions or non-existence) are better
represented by Log.e as they are often recoverable or expected under
certain conditions, and not always indicative of a fatal application state.

Flag: EXEMPT mainline
Bug: 429012888
Test: TH
Change-Id: I717d46d4c3802ac478e80d2a9dd28c79a9ebc5f7

Jimi Chen   commited 2025-07-18 06:11:15 +00:00
83298a7b5d
NetBpfLoad: Extract map type sanitization into a helper function
Bug: 428792764
Flag: EXEMPT logging only change
Test: TH
Change-Id: Ibb1f1ea1ccaacd6e49ae525ddee398ff405b3d9f

Motomu Utsumi   commited 2025-07-18 10:14:37 +09:00
c80abe1bce
NetBpfLoad: Extract prog validation into a helper function
Bug: 428792764
Flag: EXEMPT no-op
Test: TH
Change-Id: I1007f4f365580ccc75015a85c3ef545bfddc7f24

Motomu Utsumi   commited 2025-07-18 10:11:32 +09:00
1d25bb35f2
NetBpfLoad: Extract prog pinning logic into a helper function
Bug: 428792764
Flag: EXEMPT no-op
Test: TH
Change-Id: I51c25918bec3951afca3401de8e2f0ff62ced684

Motomu Utsumi   commited 2025-07-18 10:11:26 +09:00
597f3afeb4
NetBpfLoad: Move selinux_context logging for prog
This is to prepare for splitting out the method for pinning a prog.

Bug: 428792764
Flag: EXEMPT logging only change
Test: TH
Change-Id: Iedfc8f3941f8e8b0e70e4dfbc47520b29d332c3e

Motomu Utsumi   commited 2025-07-18 10:11:21 +09:00
1e0675c0ce
NetBpfLoad: Extract map pinning logic into a helper function
Bug: 428792764
Flag: EXEMPT no-op
Test: TH
Change-Id: I4124756f07f5f0a3be9946b8a97faf7669f1615f

Motomu Utsumi   commited 2025-07-18 10:11:15 +09:00
77b0b25376
NetBpfLoad: Move selinux_context logging for map
This is to prepare for splitting out the method for pinning a map.

Bug: 428792764
Flag: EXEMPT logging only change
Test: TH
Change-Id: Iebaeea3150a99e85c25bb106e74ce3fc7f9ddb50

Motomu Utsumi   commited 2025-07-18 10:11:09 +09:00
4e024762a0
NetBpfLoad: Add libbpf-style map definitions for libbpf support
This updates the BPF map macros so programs can be loaded by both the
existing code and the libbpf.
The macros now generate ".maps" section in addition to the
".android_maps" section.

To prevent name collisions, the legacy map definitions are suffixed with
_def. This CL also adds the readMapNames method to get map names from
the ".android_maps" section, allowing the existing code path to continue
working.

Bug: 428792764
Flag: EXEMPT no-op
Test: TH
Change-Id: Ibe6f100b5684bc85d2cf9c100f2431740fa516ca

Motomu Utsumi   commited 2025-07-18 10:11:02 +09:00
e5dcaf78e3
NetBpfLoad: Update map helpers to support libbpf
Libbpf-style map definitions use unique anonymous structs, so each map
has an incompatible type.

This CL updates the helper functions to use void* type for the map
argument, making them compatible with the libbpf format.

Bug: 428792764
Flag: EXEMPT no-op
Test: TH
Change-Id: Ia5a91686c281dd4ec593b2f6ff322fe0c06e1009

Motomu Utsumi   commited 2025-07-18 10:10:55 +09:00
3c8fae388e
NetBpfLoad: Remove unnecessary reuse flag in map creation
The reuse boolean was set to true only in a code path that
immediately called abort().

Bug: 428792764
Test: TH
Flag: EXEMPT no-op
Change-Id: I157e9f09c87eedc82c24d4ec821dcb132a389e31

Motomu Utsumi   commited 2025-07-18 10:10:47 +09:00
04de3498c7
Merge "Add beta flag for lnp developer opt in" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-07-17 16:32:04 -07:00
0f7a594c0d
Merge "Use beta flag for bluetoothTetheringRandomizedAddress" into main
Motomu Utsumi   authored and   Android (Google) Code Review   commited 2025-07-17 15:35:10 -07:00
5286486f3b
Add beta flag for lnp developer opt in
Bug: 369821572
Test: m
Flag: com.android.tethering.mainline.beta.lnp_developer_opt_in
Change-Id: I99884977a82f9a5a4c530edd6d3474dfeb2a3a52

Hao Liu   commited 2025-07-17 21:37:37 +00:00
ece0d94d7f
Use beta flag for bluetoothTetheringRandomizedAddress
Bug: 287177081
Test: TH
Flag: com.android.tethering.mainline.beta.bluetooth_tethering_randomized_address
Change-Id: I1de9f4bb15c8423f09381a0c7513f0d7ebf80856

Motomu Utsumi   authored and   Hao Liu   commited 2025-07-17 21:30:07 +00:00
4b4f3018a5
Fix permissions in RestoreEthernetRule
The previous runAsShell calls adopted permissions spuriously. This
change fixes runAsShell to consistently adopt the correct permission
for the respective API call.

Also calls setEthernetEnabled() no matter what the current state is at
the end of the test (as there is no harm in doing so).

Test: TH
Flag: EXEMPT mainline
Change-Id: Ib11b889148213b160567cf0a3b9ea72b5b0c851e

Patrick Rohr   commited 2025-07-17 13:54:12 -07:00
ac29211362
Reapply "Fix EthernetManagerTest"
This reverts commit f28878b120.

Reason for revert: The original change was incompatible with
ag/34622357. Reapplying the fixed CL.

Bug: 432497516
Change-Id: I1b19b3336a4c938ef1adbd12c50a11903d373194

Patrick Rohr   commited 2025-07-17 11:32:44 -07:00
bdee78a22e
Revert "Fix EthernetManagerTest"
This reverts commit e9dcc62d2d.

Reason for revert:  DroidMonitor: reverting due to http://b/432497516. I will verify through ABTD before revert submission. 

https://buganizer.corp.google.com/issues/432497516#comment6

Bug: 432497516
Change-Id: I4773c0493137367cb0d4167eab535e0d827956ee

Liana Kazanova (xWF)   commited 2025-07-17 11:22:23 -07:00
f28878b120
Merge changes I6fb98e87,I3f61b474 into main
* changes:
  Delete unused TestInterfaceStateListener
  Reset EthernetManagerTest to reintroduce InterfaceStateListener

Patrick Rohr   authored and   Android (Google) Code Review   commited 2025-07-17 09:33:42 -07:00
7134b8ca22
NetBpfLoad: templatize readSectionByName
This is a cherry-pick of ag/34620710 to NetBpfLoad

Test: TH
Flag: EXEMPT no-op
Bug: 428792764
Change-Id: I651d7661e0a1a4dd4aa23a116ee2e211a31505f0

Motomu Utsumi   commited 2025-07-17 08:51:27 -07:00
99a7b7388e
NetBpfLoad: Refactor map/prog data copying to use a single memcpy
This is a no-op because the data in the ".android_maps"/"progs" section
is an array of struct bpf_map_def/bpf_prog_def.

Test: TH
Flag: EXEMPT no-op
Bug: 428792764
Change-Id: I80bd8c72c68b5359cf1b16ed5d4739a854169d7f

Motomu Utsumi   commited 2025-07-17 08:50:51 -07:00
8073ad8606