Commit graph

111,279 commits

Message SHA1
bpf/progs/offload.c: disable ipv6 offload for non-gso >pmtu
Bug: 263884894
Bug: 419747540
Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Idecc355084220ea5c53924c720c806adab153b5d

Maciej Żenczykowski   commited 2025-06-02 01:14:16 -07:00
5d79fdffd3
Merge "bpf/progs/offload.c: split ipv6 offload for 5.4+ kernels" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-06-02 00:52:27 -07:00
c9c16fc884
Merge "Refactor: Pass parameterized argument via test constructor" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-06-01 21:09:55 -07:00
7b633c65ef
Merge "DHCPv6 addr reg: add ADDR_REG_INFORM and ADDR_REG_REPLY message types." into main
Xiao Ma   authored and   Android (Google) Code Review   commited 2025-06-01 17:23:12 -07:00
bb47bc9433
bpf/progs/offload.c: split ipv6 offload for 5.4+ kernels
(no-op prep work for gso support)

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

Maciej Żenczykowski   commited 2025-06-01 00:49:39 -07:00
84c89b1498
Update start timestamp for querying data usage
The previous implementation used a fixed start timestamp for
querying network usage statistics, initialized based on the
device's boot time. This caused the query window to grow
indefinitely as the device uptime increased, leading to
inefficient queries that fetched and processed a large
ever-expanding amount of historical data.

This change refactors the logic to use a rolling start
timestamp. The `mStartTime` is now updated after each
usage report is generated (in `onLost`). By resetting
the start time to a more recent point (current time
minus one bucket duration), we ensure that subsequent
queries for usage snapshots are performed over a small,
manageable time window.

This optimization prevents fetching excessive data
from the NetworkStatsManager, improving the efficiency
of the metrics collector. Dependencies for time and
duration have also been abstracted for better testability.

Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.metrics.SatelliteCoarseUsageMetricsCollectorTest \
  --update-device
Flag: EXEMPT controlled with kill switch
Bug: 419123367
Change-Id: I49d3b044f0a038093060f5541ea263d2d0d253a2

Junyu Lai   commited 2025-05-31 16:37:59 +08:00
48c3c2bf10
Report satellite coarse usage
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.metrics.SatelliteCoarseUsageMetricsCollectorTest \
      --update-device
Test: atest ConnectivityCoverageTests --test-filter 'CSTest*' --update-device
Test: atest ConnectivityCoverageTests --test-filter 'ConnectivityService*' --update-device
Test: Manual:
  1. Change code to use TRANSPORT_CELLULAR
  2. m statsd_testdrive && statsd_testdrive -e 1102
  3. Turn off mobile data.
Flag: EXEMPT controlled with kill switch
Bug: 419123367
Change-Id: I264efa6802612809fdbff22901f31447f370bbe5

Junyu Lai   commited 2025-05-31 16:37:59 +08:00
bb589cf33c
Merge changes Ic9233784,I093c0bb4,I3c90bf84,I3d1f08aa into main
* changes:
  Move setInterfaceUpState out of try / catch block
  Pass EthernetPort to onNewLink / onDelLink
  Populate EthernetPort object in netlink handler
  s/isValidEthernetInterface/shouldTrackInterface/

Patrick Rohr   authored and   Android (Google) Code Review   commited 2025-05-30 16:12:53 -07:00
f17adec833
Merge changes from topic "destroy_socket_at_cs" into main
* changes:
  Destroy sockets lacking permission at CS.
  Destroy sockets with nlmsg RTM_DELADDR
  Destroy sockets with NetworkAgent update event
  Add a Map to NetworkAgent list for IP address
  Add socket destroying methods to InetDiagMessage.

Sewook Seo   authored and   Android (Google) Code Review   commited 2025-05-30 16:00:11 -07:00
13e6742742
Move setInterfaceUpState out of try / catch block
setInterfaceUpState does not need to be in the try / catch block as it
doesn't let any exceptions escape. Also move the call to after checking
whether the returned config is null. In practice, this should never
happen; but if it did, we wouldn't end up doing anything anyways, so
bringing up the interface is pointless.

This also annotates config as final and returns early out of the catch
block (because the second log statement is technically incorrect).

Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: Ic9233784594ead6779caf6267afad7b518a873ea

Patrick Rohr   commited 2025-05-30 11:47:22 -07:00
818f183fc4
Pass EthernetPort to onNewLink / onDelLink
Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: I093c0bb49c31af5722c9907eec05b33a32086bc8

Patrick Rohr   commited 2025-05-30 11:40:22 -07:00
4deae2ff49
Populate EthernetPort object in netlink handler
Figuring out whether an interface is a USB NCM interface requires
calling the ethtool API. In order to ensure the interface does not
change underneath us, it must use the ifindex rather than the interface
name.

This change starts populating EthernetPort, a tuple containing interface
name, MacAddress, and index, using the information received from
rtnetlink.

Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: I3c90bf844304f710ebf0a629d66ebcb487e144e7

Patrick Rohr   commited 2025-05-30 11:30:00 -07:00
57331f1682
s/isValidEthernetInterface/shouldTrackInterface/
In preparation for tracking USB NCM interfaces independent of whether
they were included as part of the regex.

Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: I3d1f08aac20d613db9e845044b11b9484ddba2ed

Patrick Rohr   commited 2025-05-30 11:30:00 -07:00
649b3ad0d3
Add alint hook to Connectivity repo
Onboarding repo to go/alint, which will run ayeaye analyzers locally.

Bug: 419241911
Test: Locally
Flag: NONE, repo change
Change-Id: I78b938222ac73f00438692045e4c062cb5356029

Doğancan Emek   commited 2025-05-30 11:36:49 +00:00
9fecf5dee1
DHCPv6 addr reg: add ADDR_REG_INFORM and ADDR_REG_REPLY message types.
Flag: EXEMPT guarded by an legacy experiment flag
Bug: 293393743
Test: TH
Change-Id: If2b30265c45e3a57c867fd7ba1df5f4245a37b35

Xiao Ma   commited 2025-05-30 16:51:55 +09:00
eb1cc9441c
Destroy sockets lacking permission at CS.
Move destroying socket logic for lacking permission to CS from netd

Bug: 373280981
Bug: 331139818
Flag: android.net.platform.flags.connectivity_service_destroy_socket
Test: atest ConnectivityCoverageTests
Test: device test

Change-Id: Id933d51d6175958a1b78443360858db577319622

Sewook Seo   commited 2025-05-29 20:15:47 -07:00
34ef7dbd1b
Destroy sockets with nlmsg RTM_DELADDR
Destroy sockets that matched to netId less than MIN_NET_ID for the non
link local address in RTM_DELADDR.
Destroy sockets on link local address with the corresponding interface
ID.

Bug: 373280981
Bug: 331139818
Flag: android.net.platform.flags.connectivity_service_destroy_socket
Test: atest ConnectivityCoverageTests
Test: device test
Change-Id: I4d8127fc693f8b32f815c5cddbae0b64deeb23e5

Sewook Seo   commited 2025-05-29 20:14:13 -07:00
fe1f5cbf32
Destroy sockets with NetworkAgent update event
Destroy platform managed sockets on the removed IP address based on NetworkAgent update.

Bug: 373280981
Bug: 331139818
Flag: android.net.platform.flags.connectivity_service_destroy_socket
Test: atest ConnectivityCoverageTests
Test: device test
Change-Id: I6a1d2d0c25c130c2747d66bee203b0408e2fa0da

Sewook Seo   commited 2025-05-30 03:10:38 +00:00
1af98cb493
Merge "Change RequestTracker log tag to TetheringRequestTracker" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-05-29 19:02:15 -07:00
9e06f4d2c4
Change RequestTracker log tag to TetheringRequestTracker
So related logs show up when grep'ing for tethering.

Test: TH
Bug: 10000001
Flag: EXEMPT trivial
Change-Id: I86791be62a068a8a64eca35fd5ce01ecde750a04

Patrick Rohr   commited 2025-05-29 11:12:14 -07:00
e4db9c7316
bpf/progs/offload.c: disable ipv4 offload for non-gso >pmtu
Bug: 263884894
Bug: 419747540
Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I937bd3e40ba0b8c2e1297e25582cd074d89ebb48

Maciej Żenczykowski   commited 2025-05-29 09:15:15 -07:00
954bc98a22
bpf/progs/offload.c: split 4.14/4.19/5.4 into 4.14/4.19 & 5.4
Prep work to allow 5.4+ specific implementation.

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

Maciej Żenczykowski   commited 2025-05-29 08:50:50 -07:00
bda15bd5c1
bpf/progs/offload.c: fix kver of full implementations
The full implementations are targeted for 5.10 kernels (S+), not 5.8.
Let's update the names to reflect that.

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

Maciej Żenczykowski   commited 2025-05-29 08:06:45 -07:00
1f830cd497
Merge "BpfSyscallWrappers.h: fix to pass 'attr' by address instead of by const reference" into main
Maciej Żenczykowski   authored and   Android (Google) Code Review   commited 2025-05-29 04:37:27 -07:00
a3b8091626
Merge "NetBpfLoad: Add errno to log for map verification failures" into main
Maciej Żenczykowski   authored and   Android (Google) Code Review   commited 2025-05-29 03:57:50 -07:00
83566c1857
BpfSyscallWrappers.h: fix to pass 'attr' by address instead of by const reference
(shot in the dark)

checking attr.info.info_len in line 265 could probably be optimized out if we pass by const reference, since one could assume it is still sizeof(info).

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

Maciej Żenczykowski   commited 2025-05-29 02:43:55 -07:00
f53f0f0e21
Merge "Clean up eventuallyExpectLost" into main
Maciej Żenczykowski   authored and   Android (Google) Code Review   commited 2025-05-29 01:34:58 -07:00
d84de68e38
NetBpfLoad: Add errno to log for map verification failures
We sometimes see issues when trying to load BPF maps, it's helpful to know
what errno was set.

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

Maciej Żenczykowski   commited 2025-05-29 01:25:26 -07:00
4b3937b7f3
Merge "Support checking transport types in NetworkTemplate" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-05-28 22:38:11 -07:00
7c9babc63b
Clean up eventuallyExpectLost
Not needed anymore.

Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: I16266685530171ece9cac0dc911c88639b5481bf

Patrick Rohr   commited 2025-05-28 15:28:37 -07:00
fbbb9def0f
Merge "Clean eventuallyExpect invocations" into main
Patrick Rohr   authored and   Android (Google) Code Review   commited 2025-05-28 15:09:28 -07:00
3bdd67a669
Fix flake in EthernetManagerTest
Depending on how the DAD timers align, there could be 1 or 2
onLinkPropertiesChanged callbacks. Furthermore, depending on how the
dice fall, NO_CALLBACK_TIMEOUT is too short (500ms) to account for this.

This CL changes the expectation from expect<Lost> to
eventuallyExpect<Lost> to skip over any onLinkPropertiesChanged
callbacks that might have been received.

Test: atest EthernetManagerTest#testUpdateConfiguration_forAllowedUids
Flag: EXEMPT mainline
Bug: 420648099
Change-Id: Ifa853accdfca2c00de4d7211badc75ae057d948f

Patrick Rohr   commited 2025-05-28 13:08:24 -07:00
f1e3848b33
Merge "Refactor: apply pyformat for coding style consistency" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-05-28 07:26:50 -07:00
0d0d3a6534
Merge "Add notice of requesting source code in tethering" into main
Manish Singh   authored and   Android (Google) Code Review   commited 2025-05-28 06:40:11 -07:00
3ea6a7ca9f
Refactor: apply pyformat for coding style consistency
add pyformat for presubmit hook

Flag: EXEMPT mainline
Bug: 419423721
Test: atest CtsConnectivityMultiDevicesTestCases
Change-Id: I9abc5cee454e8c8e21ce7e3c134145857680251f

Jimi Chen   commited 2025-05-28 12:44:57 +00:00
dcbe9b403d
Support checking transport types in NetworkTemplate
This change verifies that:
 1. For a given match rule, if transports are specified, a deduced
    transport type should be included. For example, if MATCH_WIFI
    is specified, TRANSPORT_WIFI should be included if at least one
    transport is specified.

Flag: EXEMPT implemented in the counter-part CL
Test: atest ConnectivityCoverageTests --test-filter \
  'NetworkTemplate*' --update-device
Bug: 419123367
Change-Id: Ic8375e50c3587ef2b757d1c3241f97482d93808b

Junyu Lai   commited 2025-05-28 18:24:56 +08:00
572575ee95
Merge "Replace get_apf_counter from apf shell command instead of dumpsys" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-05-27 23:37:11 -07:00
bd96bad987
Replace get_apf_counter from apf shell command instead of dumpsys
Flag: EXEMPT mainline
Bug: 419423721
Test: atest NetworkStaticLibHostPythonTests
Change-Id: I6f5f93acb13503ce23066b1541c0843f6d7951d2

Jimi Chen   commited 2025-05-28 04:55:33 +00:00
5e69785de3
Merge "Enable TrafficStats Client-Side Cache by default" into main
Junyu Lai   authored and   Android (Google) Code Review   commited 2025-05-27 19:06:46 -07:00
45c38e8cbf
Add a Map to NetworkAgent list for IP address
Keeping a map from IP addresses to the list of NetworkAgentInfos that have
that IP address in their LinkProperties.

Bug: 373280981
Bug: 331139818i
Flag: android.net.platform.flags.connectivity_service_destroy_socket
Test: atest ConnectivityCoverageTests
Test: device test
Change-Id: I1e39ce00d8bc49252df8088efc768804ae9ee0a8

Sewook Seo   commited 2025-05-27 22:59:43 +00:00
720ccd2b32
Merge "Support matches transport types in NetworkTemplate" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-05-27 11:01:30 -07:00
1f24f28343
Merge "[owners] Remove derekjedral@google.com from remoteauth/OWNERS" into main
Owner Cleanup Bot   authored and   Android (Google) Code Review   commited 2025-05-27 07:13:46 -07:00
54c844566e
Merge "Fix C++23 build: add missing #include." into main
Elliott Hughes   authored and   Android (Google) Code Review   commited 2025-05-27 06:08:11 -07:00
1fab40fd14
Support matches transport types in NetworkTemplate
Flag: EXEMPT implemented in the counter-part CL
Test: atest CtsNetTestCases --test-filter \
      'NetworkStats*' --update-device
Test: atest ConnectivityCoverageTests --test-filter \
      'NetworkStats*' --update-device
Test: atest ConnectivityCoverageTests --test-filter \
      'NetworkTemplate*' --update-device
Bug: 419123367
Change-Id: I0c8bf2e24502befd810081f519ff915491b0a905

Junyu Lai   commited 2025-05-27 20:35:40 +08:00
3fd36e5f93
Merge "Fill Opt-in uid count in ConnetivityStateSample" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-05-27 04:28:58 -07:00
3e75b9025d
Fill Opt-in uid count in ConnetivityStateSample
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.metrics.ConnectivitySampleMetricsTest \
  --update-device
Flag: EXEMPT controlled with kill switch
Bug: 419123367
Change-Id: I95376e30e160b4db00d018a0919be98b37d44e5e

Junyu Lai   commited 2025-05-27 17:41:47 +08:00
5b061066c9
Merge "Add NetworkCapabilities transport types into NetworkIdentity." into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-05-27 00:41:35 -07:00
2a4acb194c
Add socket destroying methods to InetDiagMessage.
Add socket destroying methods by address and permission to InetDiagMessage
to move that functions to ConnectivityService from Netd.

Bug: 373280981
Bug: 331139818
Flag: android.net.platform.flags.connectivity_service_destroy_socket
Test: atest NetworkStaticLibTests
Test: device test
Change-Id: I3c2136df5dfd618d1c757c07bce2b4211b807237

Sewook Seo   commited 2025-05-27 01:35:49 +00:00
45163857b2
Merge "Add test to check binder proxy leak after networkAgent unregistration" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-05-26 06:22:30 -07:00
9a9c72d608
Add test to check binder proxy leak after networkAgent unregistration
Bug: 400358935
Test: testRegisterUnregisterDoesNotLeakBinderProxy fails without ag/33689435
Flag: EXEMPT test only change
Change-Id: Ie54820975a7d0168eaf40faa0430294e27e58508

Motomu Utsumi   commited 2025-05-26 20:39:27 +09:00
cc1621a28b