RoutingCoordinatorService's {add,remove,update}Route methods
all end up calling netd's *RouteParcel methods.
Make callers explicitly generate and pass in the parcel to the
manager class instead of having them pass in a RouteInfo and
having the service class convert the RouteInfo to a parcel.
Also remove the {add,remove,update}Route methods from
RoutingCoordinatorManager since they are unused.
This is a no-op refactor that simplifies upcoming changes.
RoutingCoordinator is not a stable interface and is not used
across the platform/mainline boundary, so there are no version
skew considerations.
Bug: 394308861
Test: atest ConnectivityCoverageTests
Flag: EXEMPT no-op refactor
Change-Id: Iedf4c9bc28c3fc8c289db421857acddc8c694990
Lorenzo Colitticommited 2025-08-06 15:57:36 +09:00
Currently, NET_CAPABILITY_NOT_VCN_MANAGED is implicited added for
NetworkRequest built by normal apps.
However, the tethering network agent doesn't have this capability,
which makes the agent being exposed to VcnManager and cannot be
seen by normal apps.
Add NET_CAPABILITY_NOT_VCN_MANAGED to tethering NetworkAgent. Include
NET_CAPABILITY_NOT_VCN_MANAGED in local network capabilities for
metrics and API utilities to ensure correct evaluation of local
network connectivity. Update unit tests to reflect the new capability.
Flag: EXEMPT bug fix
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.CSSatisfiedByLocalNetworkMetricsTest \
ConnectivityCoverageTests:android.net.connectivity.com.android.metrics.SatisfiedByLocalNetworkMetricsTest \
--update-device
Test: manual generate request by CTS and statsd_testdrive -e 10247
Bug: 428098173
Change-Id: Ifa9ce0827abd22d887a0e8a2ab6f4d7391b2b8ed
This is both shorter and allows us to use the stringified
version of these as the automatic section suffix.
Tested: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Icf1b55f1a8f79c517631e121cf4aed6513948957
Maciej Żenczykowskicommited 2025-08-05 19:18:04 -07:00
(mostly autogenerated, with minor tweaks to make it build)
Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I718fca9ed8a4329cc53b0479159c35601e2f20d6
Maciej Żenczykowskicommited 2025-08-05 19:15:35 -07:00
We require 4.9+ for S, and M-2025-11 requires S+.
Generated via:
removal of #define KVER_NONE then:
for f in clatd.c netd.c offload.c include/bpf_helpers.h; do sed -r -i 's/KVER_NONE/KVER_4_9/' $f; done
plus addition of space to make things line up
Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I0661974304163a880a6cc8178f0db1173c1ef22f
Maciej Żenczykowskicommited 2025-08-05 19:15:35 -07:00
(mostly autogenerated, with minor tweaks to make it build)
Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ieb2be6e5515fe2b9077b1ffeb1c07628213595b3
Maciej Żenczykowskicommited 2025-08-05 19:15:35 -07:00
It's superfluous - we never use any other value, and it's unlikely we ever will.
We only run code in:
- NetBpfLoad/netd/dnsresolver which all run as uid AID_ROOT,
- System Server which runs as uid AID_SYSTEM,
- Network Stack which runs as uid AID_NETWORK_STACK,
so any other values would seem wrong.
However, groups serve the purpose better (hence why the programs are group readable),
and we have pre-existing groups to cover the combinations we care about.
Furthermore we already have sepolicy labels in place as well...
Tested: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I9535eac7eb365735fb3a9769c47ffa7067854dad
Maciej Żenczykowskicommited 2025-08-05 19:15:35 -07:00
(mostly autogenerated, with minor tweaks to make it build)
Test: TreeHugger, manually
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Iab85fc8e035d77347f4b4fd1cd5ecaf94174d997
Maciej Żenczykowskicommited 2025-08-05 19:15:35 -07:00
as we always pass in all of them in a well defined order
Test: TreeHugger, manually
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I93c4a9883983645cbe7d11101aa749dc2faf9d6d
Maciej Żenczykowskicommited 2025-08-05 12:15:03 -07:00
32-bit x86 has a crazy networking calling convention and instead of using
individual system calls has a single multiplexed socketcall()
bionic hasn't finished transitioning to the individual calls yet
which were added to Linux kernels around the 4.10-4.14-ish timeframe.
This does open a bit of security hole, since it effectively allows
all 20-ish networking system calls, but oh well, better than constantly
allowing & logging.
I don't think we'll ever want to enable KILL mode on x86-32 any way.
Test: TreeHugger
Flag: EXEMPT mainline & disabled code
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I7228132cfbf716592607d010f64d5adeeb4419aa
Maciej Żenczykowskicommited 2025-08-05 12:14:42 -07:00
* changes:
NetBpfLoad: remove spurious explicit pin location from pinProg()
bpf: switch progs from using 'pin_prefix' to 'pin_location'
bpf/progs: automate function name determination from prog section name
Maciej Żenczykowskiauthored and Android (Google) Code Reviewcommited 2025-08-05 09:41:19 -07:00
Because FakeSettingsProvider and other test infrastructure did
not support settings observers, the tests called internal
ConnectivityService methods to cause the settings to be re-read.
Now that FakeSettingsProvider supports callbacks, use
ContentResolverWithFakeSettingsProvider in the CS tests and just
use the callbacks.
Bug: 397521796
Flag: TEST_ONLY
Test: test-only change
Change-Id: I26d8e98706fec99aa423721bf1474af2f9b60099
Lorenzo Colitticommited 2025-08-05 18:02:02 +09:00
S does not have this method (and correspondingly does not have
registerContentObserverAsUser). Use the overload that
does not take a UserHandle.
Bug: 397521796
Flag: TEST_ONLY
Test: test-only change
Change-Id: Icc00abb64fdc47128b93636708990f8ab67057f2
Lorenzo Colitticommited 2025-08-05 18:02:02 +09:00
Note: I discovered that C considers:
char s[4] = "abcd";
a valid initialization without a terminating NULL, resulting
in an invalid string.
(Specifically pinned programs had a '\1' as their last char
due to little endian encoding of the next field in the array
of prog def structs)
The simplest workaround appears to be to explicitly add a "\0"
That results in a string/array that ends with 2 NULLs,
and the compiler will at most *strip* the final one.
ie.
char s[4] = "abcd\0";
fails to compile.
Obviously:
char s[100] = "abcd\0";
also does the right thing, since it 0-pads with or without the extra null.
Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Iaeb8db2cd4750f8521a971382b9f9f9f216195b2
Maciej Żenczykowskicommited 2025-08-04 18:02:51 -07:00
This is to match upstream kernel include/uapi/linux/bpf.h
Since bpf is 64-bit, so long is the appropriate width type,
and not int which is only 32-bit
Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I2685ec1e9e85aab09615d40c6c518b0251308835
Maciej Żenczykowskicommited 2025-08-04 18:00:47 -07:00
BPF is a 64-bit architecture, so this makes more sense:
int is 32-bits, while long is 64-bits.
In practice this doesn't do much, but it does make sure
the top 32-bits of the 64-bit R0 register are well defined.
I think this might matter when we try to introduce function calls,
as per Linux Kernel eBPF uapi we have (for example):
long (*callback_fn)(struct bpf_map *map, const void *key, void *value, void *ctx);
long bpf_for_each_map_elem(struct bpf_map *map, void *callback_fn, void *callback_ctx, u64 flags);
Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I0abad90043eff8f8d99c2c29988dd5ce2fef9927
Maciej Żenczykowskicommited 2025-08-04 18:00:47 -07:00
* changes:
NetBpfLoad: make loadObject() return bool
NetBpfLoad: remove comments in loadAllObjects()
NetBpfLoad: make loadAllObjects() return a bool
NetBpfLoad: make loadObject take a fully specified .o path
Treehugger Robotauthored and Android (Google) Code Reviewcommited 2025-08-04 16:06:11 -07:00
in favour of just using the info from the prog definition
which was calculated at compilation time.
Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I7542726b4c671177b30f79e90361b2dffdb38ac2
Maciej Żenczykowskicommited 2025-08-04 15:09:29 -07:00
(this matches what we did for maps)
Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I2d75fb519f00471a6f1e6b0ffded9f327ecae7b4
Maciej Żenczykowskicommited 2025-08-04 15:07:05 -07:00
This is already documented at:
//packages/modules/Connectivity/bpf/progs/include/bpf_helpers.h
which is the more logical location, since we're trying
to merge all the .o's into 1 per kernel version.
Test: TreeHugger
Flag: EXEMPT mainline/noop
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ibda074ccbbf6efdf36dffd481d953ef38b421637
Maciej Żenczykowskicommited 2025-08-04 14:08:46 -07:00