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
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
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
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
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
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
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
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 Żenczykowskicommited 2025-07-15 15:00:25 -07:00
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 Żenczykowskicommited 2025-07-15 14:46:10 -07:00
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 Żenczykowskicommited 2025-07-15 14:43:49 -07:00
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 Żenczykowskicommited 2025-07-15 14:40:11 -07:00