* 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 Robotauthored and Android (Google) Code Reviewcommited 2025-07-24 00:45:20 -07:00
* changes:
Add support for TestInterfaceMode to EthernetTracker
Move call to setEthernetEnabled inside setIncludeTestInterfaces
Add support for TestInterfaceMode in setIncludeTestInterfaces
Treehugger Robotauthored and Android (Google) Code Reviewcommited 2025-07-23 14:16:42 -07:00
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
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
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
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
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 Żenczykowskicommited 2025-07-22 12:32:08 -07:00
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 Żenczykowskicommited 2025-07-22 12:28:08 -07:00
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
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
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
* 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 Żenczykowskiauthored and Android (Google) Code Reviewcommited 2025-07-19 03:38:33 -07:00
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
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
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
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
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
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
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
This reverts commit f28878b120.
Reason for revert: The original change was incompatible with
ag/34622357. Reapplying the fixed CL.
Bug: 432497516
Change-Id: I1b19b3336a4c938ef1adbd12c50a11903d373194
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