Commit graph

111,683 commits

Message SHA1
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
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
NetBpfLoad: less copies
This is a cherry-pick of ag/34620709 to NetBpfLoad

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

Motomu Utsumi   commited 2025-07-17 08:49:51 -07:00
1ae10a006e
Fix EthernetManagerTest
This patch fixes EthernetManagerTest as follows:
(1) testEnableDisableInterface_disableEnableEthernet
    Fix the test error when USB interface is present and treated as
    ethernet interfaces.
(2) testRemoveInterface_disableEnableEthernet
    Fix the error When tethering interface already presents.

Bug: 427055553
Test: atest ConnectivityCoverageTests
Flag: EXEMPT mainline

Change-Id: I2a31f3f0434b35e9ebe96b4f7003e5a9be0d3e81

Chuwei He   commited 2025-07-17 14:50:26 +09:00
e9dcc62d2d
Delete unused TestInterfaceStateListener
Test: TH
Flag: EXEMPT mainline
Change-Id: I6fb98e87ca1aa460aca6d08cbdd5ddcaaaee55de

Patrick Rohr   commited 2025-07-16 11:21:08 -07:00
3563cc1725
Reset EthernetManagerTest to reintroduce InterfaceStateListener
The previous changes to move EthernetStateListener and
InterfaceStateListener introduced 2 separate ArrayTrackRecords. This
test explicitly uses a single TrackRecord for both callbacks, so their
respective ordering can be tested.

This change resets EthernetManagerTest to the last known good state
(57fdd00cc7).

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

Patrick Rohr   commited 2025-07-16 11:21:08 -07:00
576677cc5e
Merge changes I332c8d43,I340bcb77 into main
* changes:
  Simplify APF IGMPv3 general query offload test
  refactor: Lazy load IP addresses for APF tests

Jimi Chen   authored and   Android (Google) Code Review   commited 2025-07-16 07:38:59 -07:00
5904ce1431
Simplify APF IGMPv3 general query offload test
Reduce the number of multicast addresses used in
`test_igmpv3_general_query_offload` to simplify the test case and
focus on the core functionality.

Flag: EXEMPT mainline
Bug: 419427388
Test: atest CtsConnectivityMultiDevicesTestCases:ApfV6Test
Change-Id: I332c8d43bd89a444728ed7ebde3f4e064e4e39aa

Jimi Chen   commited 2025-07-16 04:31:44 +00:00
e42fb901b9
refactor: Lazy load IP addresses for APF tests
Previously, IPv4 and IPv6 addresses were retrieved in `ApfTestBase.setup_class`,
which meant all APF tests assumed the presence of both.

This change refactors `ApfTestBase` to introduce dedicated methods:
- `get_and_expect_ipv4_addresses_exist()`
- `get_and_expect_ipv6_addresses_exist()`

These methods now handle the retrieval and assertion of IP addresses.
Individual test cases in `ApfV6Test` are updated to call these methods
only when the respective address type is required for the specific test
scenario.

This improves test robustness by ensuring tests only depend on the
necessary IP addresses, allowing for more precise test setup and failure
reporting. Additionally, the doze mode activation is reordered to occur
after initial network setup.

Flag: EXEMPT mainline
Bug: 419427388
Test: atest CtsConnectivityMultiDevicesTestCases:ApfV6Test
Change-Id: I340bcb77fe66cc9927dcd58e5899cdf9a4375daa

Jimi Chen   commited 2025-07-16 04:31:40 +00:00
419e088796
Merge "Ignore RtNetlinkMessage with null or empty interface names" into main
Chuwei He   authored and   Android (Google) Code Review   commited 2025-07-15 20:47:39 -07:00
27013988a7
Merge "Add metrics for QUIC connection close" into main
Motomu Utsumi   authored and   Android (Google) Code Review   commited 2025-07-15 20:32:42 -07:00
e5d4a0fca3
Merge "NetBpfLoad: don't print multiline log_buf on user builds" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-07-15 20:05:23 -07:00
0298e7f4b7
Merge "bpf: remove zero uid hack" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-07-15 20:05:22 -07:00
792f685d65
Merge changes I9114d27c,I8e8f62ed into main
* changes:
  bpf: rename 'maps' section to '.android_maps'
  NetBpfLoad: remove support for .o wide bpfloader_{min,max}_ver

Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-07-15 20:05:20 -07:00
ef77e34e39
Merge "bpf: remove size_of_bpf_{map,prog}_def" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-07-15 19:39:44 -07:00
0c01e5f0a8
Ignore RtNetlinkMessage with null or empty interface names
This patch checks if interface name is null or empty for
RtNetlinkMessage and ignores the message if it is.

Bug: 429497348
Test: build
Flag: EXEMPT bugfix
Change-Id: I6000f5442f341f152b7fbd235affded0fa56fe50

Chuwei He   commited 2025-07-15 18:43:07 -07:00
16c8fd1166
Merge "Disconnect a network if it's suspended for 5 minutes for wear" into main
Hongyi Zhang   authored and   Android (Google) Code Review   commited 2025-07-15 18:09:56 -07:00
29ae4e7b43
NetBpfLoad: don't print multiline log_buf on user builds
These tend to be huge (because they can contain the full bpf disassembly)
but not very worthwhile, because they often result in logs being rate
limitted, and thus we miss out on the useful information.

This is particularly true for user builds on non-Google devices
installing the production signed tethering apex mainline module.

We're better off seeing more of the other log lines...

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

Maciej Żenczykowski   commited 2025-07-15 15:00:25 -07:00
f125992b27
bpf: remove zero uid hack
Not needed any more, since no more loader vs .o version skew.

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

Maciej Żenczykowski   commited 2025-07-15 14:46:10 -07:00
cb0433611e
bpf: rename 'maps' section to '.android_maps'
For libbpf compatibility we will want to have a 'normal' looking
.maps section & an android-only .android_maps section.

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

Maciej Żenczykowski   commited 2025-07-15 14:43:49 -07:00
b27d2137d6
NetBpfLoad: remove support for .o wide bpfloader_{min,max}_ver
This is not needed, as this is now simply hard coded (along with the
.o names themselves) inside of NetBpfLoad.cpp itself - see loadAllObjects().

Even if it wasn't, we're better off using the per-map & per-program
limits instead.  These will already cause all maps/programs to be skipped...

(The only reason to have a global per .o one was to solve
.o vs loader version skew issues, which we can no longer have)

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

Maciej Żenczykowski   commited 2025-07-15 14:40:11 -07:00
c4a1cae939