Commit Graph

2605 Commits

Author SHA1 Message Date
Jean Chalard
8b7208a8a5 Merge "Add forwarding methods to RoutingCoordinator" into main am: 23376e6fe7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2777668

Change-Id: Ib89b987a8d9a5e9b133bbff7333f8296af3e477f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-27 05:42:04 +00:00
Jean Chalard
23376e6fe7 Merge "Add forwarding methods to RoutingCoordinator" into main 2023-10-27 05:12:07 +00:00
Chalard Jean
55ccfe19e2 Add forwarding methods to RoutingCoordinator
Test: RoutingCoordinatorServiceTest
      TetheringTest
Change-Id: Ic3b36ddc236e8615e7d931b6e526556bbd2dac17
2023-10-26 20:18:48 +09:00
Maciej Żenczykowski
dbf8d3025e Merge "remove dead portions of BpfUtils.java" into main am: bee431759a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2803204

Change-Id: Ib920e77884fb0d1d88d45c93a84cbd19b7244484
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-25 23:21:24 +00:00
Maciej Żenczykowski
de9d367ab2 remove dead portions of BpfUtils.java
(mostly to improve code coverage)

We can always revert if it ever turns out this is useful,
but I'd prefer for cgroup attach to be a once-at-boot
thing and handled either from bpfloader or the netd updatable
which are both directly C++ code.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I79b5ca8a47388cb6b9189234942e74ab6056aab9
2023-10-25 17:40:35 +00:00
Jean Chalard
5b0ebeabeb Merge "Add a routing coordinator class" into main am: 4e47533688
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2729133

Change-Id: Ibadbe0c4cf62a148d7051a162bfd86a3b047252e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-25 09:46:03 +00:00
Jean Chalard
4e47533688 Merge "Add a routing coordinator class" into main 2023-10-25 09:13:16 +00:00
Junyu Lai
bfd5e9d274 Merge "Revert "Revert "[BR07.1] Expose setDataSaverEnabled from Connect..."" into main am: 0cfaea8d98
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2801074

Change-Id: Idf9003f52a119033cd76cde87b6becf70fa03f15
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-25 02:28:36 +00:00
Junyu Lai
0cfaea8d98 Merge "Revert "Revert "[BR07.1] Expose setDataSaverEnabled from Connect..."" into main 2023-10-25 01:59:12 +00:00
Chalard Jean
2fb66f1b28 Add a routing coordinator class
Test: In followup changes : RoutingCoordinatorManagerTest
Change-Id: Ia6811d614e02123a072c7638291828745abae051
2023-10-24 22:12:26 +09:00
Junyu Lai
df210365fe Revert "Revert "[BR07.1] Expose setDataSaverEnabled from Connect..."
Revert submission 2799494-revert-2745215-npmsbpf-OBOPDXREUI

Reason for revert: Need to 1. Merge API first. 2. Wait for prebuilt. 3. Merge the caller.

Reverted changes: /q/submissionid:2799494-revert-2745215-npmsbpf-OBOPDXREUI

Change-Id: Icd5f3d40595a0d2a221b016cec70568bf3597c16
2023-10-24 07:30:23 +00:00
Junyu Lai
8f1730ebf9 Merge "[BR01.1] Support BpfNetMapsReader" into main am: a62eed380c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2725213

Change-Id: I0a9955e7fa9d51b423f8cd1113553dd492caf843
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-24 06:19:04 +00:00
Jordan Silva
842bdb6564 Merge "Revert "[BR07.1] Expose setDataSaverEnabled from ConnectivityManager"" into main am: 118c2646f3
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2799494

Change-Id: Ifcb1c1db20028880aaa192db5827d98253f8c7c8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-23 15:34:59 +00:00
Jordan Silva
118c2646f3 Merge "Revert "[BR07.1] Expose setDataSaverEnabled from ConnectivityManager"" into main 2023-10-23 15:12:50 +00:00
Jordan Silva
457ae0f00f Revert "[BR07.1] Expose setDataSaverEnabled from ConnectivityManager"
Revert submission 2745215-npmsbpf

DroidMonitor: Potential culprit for Bug 307256512 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.


Reason for revert: 307256512

Reverted changes: /q/submissionid:2745215-npmsbpf

Change-Id: I27119a7484453d1369bbdf71ad2479edec7d664f
2023-10-23 13:23:01 +00:00
Junyu Lai
626045a601 [BR01.1] Support BpfNetMapsReader
A helper class to *read* java BpfMaps. This is designed to
provide direct bpf access in the caller process through
ConnectivityManager APIs.

The change also removes any statical link to
net-utils-device-common-struct from service-connectivity.
This is because net-utils-device-common-struct is already
included in framework-connectivity. Including it again in
service-connectivity would create a r8 build fail by circular
dependency.

Test: atest FrameworksNetTests:android.net.connectivity.com.android.server.BpfNetMapsTest
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.net.module.util.StructTest
Test: atest FrameworksNetTests:android.net.connectivity.android.net.BpfNetMapsReaderTest
Bug: 297836825
Change-Id: I7a6d2eb816d0dc7343167bddd672806b199f44fe
2023-10-23 20:11:02 +08:00
Junyu Lai
ee6724e314 Merge "[BR07.1] Expose setDataSaverEnabled from ConnectivityManager" into main am: d88205a1ae
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2745215

Change-Id: Ic4b0a41f288398a5334377d5aaab40f3fe0ef07a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-23 11:43:33 +00:00
Junyu Lai
d88205a1ae Merge "[BR07.1] Expose setDataSaverEnabled from ConnectivityManager" into main 2023-10-23 11:21:53 +00:00
Jean Chalard
a4b92a6b57 Merge "Reapply "Add LocalNetworkConfig"" into main am: e32bf36be8
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2792436

Change-Id: I1f4843b60ab7aeecfd3df90d6a767775484e0ce8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-20 06:41:55 +00:00
Jean Chalard
e32bf36be8 Merge "Reapply "Add LocalNetworkConfig"" into main 2023-10-20 06:25:14 +00:00
Maciej Żenczykowski
248f29b53d Merge "Support shell command to get bpf program id" into main am: 5c2b517d6a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2773825

Change-Id: Ifb7cd890f58a68e60a921dab747d6c3196b1a257
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-19 23:01:27 +00:00
Maciej Żenczykowski
5c2b517d6a Merge "Support shell command to get bpf program id" into main 2023-10-19 22:35:04 +00:00
Junyu Lai
83eb7fc1cb Merge "Dump bpf program status in dumpsys" into main am: eb75416136
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2774206

Change-Id: I22bfe10165de8de395422566f307b644714699ef
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-19 10:09:34 +00:00
Junyu Lai
c279f1830e [BR07.1] Expose setDataSaverEnabled from ConnectivityManager
Currently, data saver switch is controlled in NPMS, which
calls into NetworkManagementService and netd when switching
status. In netd, BandwidthController manipulates the
bw_data_saver chain to control the overall behavior.

However, this code are all platform implementation, which
are not updatable. In order to migrate data saver switch
from iptables to bpf, this API is needed for Connectivity to
change the implementation to directly write bpf in later
patches.

Test: atest CtsHostsideNetworkTests:com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Test: atest FrameworksServicesTests:NetworkManagementServiceTest
Bug: 297836825
Change-Id: I71fa41ca739fef8e191fba91b02758ad5f732d5c
2023-10-19 17:43:44 +08:00
Junyu Lai
eb75416136 Merge "Dump bpf program status in dumpsys" into main 2023-10-19 09:33:27 +00:00
Junyu Lai
452e464ee9 Support shell command to get bpf program id
Test: atest NetworkStatsIntegrationTest#testBpfProgramAttachStatus
Bug: 292156770

Change-Id: I815be0f3f3592442939872f98e3ad9d224a6aeb6
2023-10-18 16:06:15 +08:00
Junyu Lai
155760b57b Dump bpf program status in dumpsys
Sample output:
Bpf Program Status:
  CGROUP_INET_INGRESS: 21
  CGROUP_INET_EGRESS: 22
  CGROUP_INET_SOCK_CREATE: 28
  CGROUP_INET4_BIND: 30
  CGROUP_INET6_BIND: 31

Test: adb shell dumpsys connectivity
Test: atest FrameworksNetTests:android.net.connectivity.com.android.server.ConnectivityServiceTest#testDumpDoesNotCrash
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.ConnectivityServiceTest#testDumpDoesNotCrash
Bug: 292156770
Change-Id: I312c90c524af12d093536156d6d5c6febd64305a
2023-10-18 16:05:55 +08:00
Chalard Jean
f9d0e3e94f Reapply "Add LocalNetworkConfig"
This reverts commit 6eea22b18c.

Change-Id: I0a2cef4ee992577674c92ecd384dc6f4361afa02
2023-10-18 15:50:02 +09:00
Jean Chalard
1a127b05ea Merge "Reapply "Tell netd about local networks"" into main am: de0f4e5b87
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2792435

Change-Id: I33c0d6e79f579764d8cd51690c0fdbf18cc3f21d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-17 13:34:09 +00:00
Jean Chalard
de0f4e5b87 Merge "Reapply "Tell netd about local networks"" into main 2023-10-17 13:00:46 +00:00
Junyu Lai
c58926b4ec Merge "Move dumpsys to handler thread" into main am: 5606bba1f9
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2785999

Change-Id: I5bd9aae3c84ac49d214d8615a1416a7e0744e931
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-17 11:38:16 +00:00
Junyu Lai
f8dba342f1 Move dumpsys to handler thread
I0afdda023208c3f8620cb5b89add66448af596d7 added some assertions
to ensure NetworkAgentInfo can only be accessed from the handler
thread. This is good to eliminate any potential concurrent
accessing problem. Howver, dumpsys runs on binder thread, this
change breaks dumpsys functionality.

Thus, this change:
  1. Copy Handler#runWithScissors() and related class
     locally since they are @hide methods.
  2. Run doDump on the handler thread and waits for return.

Test: adb shell dumpsys connectivity
Test: atest FrameworksNetTests:android.net.connectivity.com.android.server.HandlerUtilsTest
Fix: 303348620
Change-Id: Ic3a22f5d370bbf8c18b1972e86d695b6ad61bd0d
2023-10-17 17:16:04 +08:00
Chalard Jean
e0aaca5ac6 Reapply "Tell netd about local networks"
This reverts commit cc409153b4.

Change-Id: Ied6bdb9b94e08e2bfe1092765d0f4591e603c3eb
2023-10-17 17:39:23 +09:00
Anton Kulakov
fb9169d923 Merge changes from topic "revert-2777667-BKWNXIZQME" into main am: 18d14d3e78
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2786126

Change-Id: Ib00efdc8df8d72ceb1a83f0726ee3956b287a778
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-14 08:58:49 +00:00
Anton Kulakov
5306f666fb Revert "Add LocalNetworkConfig" am: 6eea22b18c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2786125

Change-Id: Ia711af732a95933636b99c3d7e44ae8170dcb67e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-14 08:58:46 +00:00
Anton Kulakov
cc409153b4 Revert "Tell netd about local networks"
Revert submission 2777667

Reason for revert: DroidMonitor-triggered revert due to breakage, bug b/305187495

Reverted changes: /q/submissionid:2777667

Bug: 305187495

Change-Id: Icb46558d17b56f9f6fd402f1489de9ed2b8f7644
2023-10-13 15:23:59 +00:00
Anton Kulakov
6eea22b18c Revert "Add LocalNetworkConfig"
Revert submission 2777667

Reason for revert: DroidMonitor-triggered revert due to breakage, bug b/305187495

Reverted changes: /q/submissionid:2777667

Bug: 305187495

Change-Id: Iae4ef936a4c111ae5668e539ce4cdbbb14c811f4
2023-10-13 15:18:55 +00:00
Jean Chalard
3f837cf542 Merge changes I3b6ee1db,I70e13303,I6fb7dfe4 into main am: a6190bd658
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2777667

Change-Id: I7c0aa8c8fff902b8585e5c09b1d571de70740f80
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-13 10:23:19 +00:00
Jean Chalard
a6190bd658 Merge changes I3b6ee1db,I70e13303,I6fb7dfe4 into main
* changes:
  Simplify addRoutesToLocalNetwork calls
  Add LocalNetworkConfig
  Tell netd about local networks
2023-10-13 09:57:18 +00:00
Chalard Jean
fa21cafc1c Add LocalNetworkConfig
This doesn't do anything at this patchset, but the whole
pipe from the agent to ConnectivityService is built.

LocalNetworkInfo will be the name of the public information
sent in callbacks to clients.

Test: CSLocalAgentTests
Change-Id: I70e133031ef3b0aaf6c3e59ccc2ad895c66d339c
2023-10-13 14:40:45 +09:00
Chalard Jean
774dc3cd51 Tell netd about local networks
This patch does the following :
• When a network is local but the system doesn't support it,
  throw in registerNetworkAgent.
• When a network is local, tell netd about it.
• Add tests for the above, as well as a test for callbacks
  being sent correctly when the caps are set and not when
  they aren't and that the new keep connected flag is
  respected.

Telling netd about the network being local has it add two
routes that do not exist if the network is not local :
• One at PRIORITY_LOCAL_NETWORK matching unmarked sockets
  and looking up the table for the interface.
20000: from all fwmark 0x0/0x10000 lookup xxxx
• One at PRIORITY_EXPLICIT_NETWORK matching explicitly on
  network 99, so that dnsmasq traffic and any OEM traffic
  marked for network 99 flowing there.
16000: from all fwmark 0x10063/0x1ffff iif lo lookup xxxx
IMPLICIT_NETWORK and EXPLICIT_NETWORK rules are installed
by connectivity service as a matter of course whether the
network is local or not.

See commit If8729fc6f3716a580c936584b851bc38000b5de5 for
implementation details of this mechanic.

There is no need to implement anything in particular for the
new connected reason, as the current implementation will
already keep it connected. A new test makes sure of that.

Test: FrameworksNetTests
      CtsNetTestCases
      FrameworksNetIntegrationTests
      NetworkStackTests
      NetworkStaticLibTests
      TetheringTests
      MtsTetheringTestLatestSdk
      TetheringIntegrationTests
Change-Id: I6fb7dfe4c232eea8cac9ac268897ddb36bb794d1
2023-10-13 14:40:38 +09:00
Hansen Kurli
1307a04994 Merge changes I22d67a7e,Ida4a4bc7,Ie8522862,Id55d8d6c into main am: ccfc52145b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2750302

Change-Id: I19f2930de302d3267b947b2b83755d7a25252076
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-13 05:23:07 +00:00
Hansen Kurli
ccfc52145b Merge changes I22d67a7e,Ida4a4bc7,Ie8522862,Id55d8d6c into main
* changes:
  Ensure nri is satisfied before returning.
  Add testLockdownVpn that mocks platform VPN.
  Make variables in testLegacyLockdownVpn() final.
  Update testLegacyLockdownVpn to mock VPN.
2023-10-13 05:00:29 +00:00
Patrick Rohr
f0b8acf604 Merge "Include both eth%d and usb%d ethernet interfaces on U+" into main am: 9b2a0d1962
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2784077

Change-Id: Ic4b391babf5d92807cf1d726d34dc7dd60f0aac6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-12 18:05:43 +00:00
Patrick Rohr
9b2a0d1962 Merge "Include both eth%d and usb%d ethernet interfaces on U+" into main 2023-10-12 17:28:34 +00:00
Patrick Rohr
11eac8e12b Include both eth%d and usb%d ethernet interfaces on U+
Ethernet interface naming is not consistent on Linux. While some USB
ethernet dongles show up as eth0, others might show up as usb0.

This CL changes config_ethernet_iface_regex to "*" which stands for "use
Android version specific default". The default will include both usb\d+
and eth%d named interfaces on Android U+. Android T will continue to
only include eth%d interfaces (note that the "+" is a new addition which
is highly unlikely to have any actual effect, but is more technically
correct).

Bug: 304335605
Test: TH
Change-Id: I823be8ee390cb2b6dd41b537c72ed76f5aa9e0ea
2023-10-12 10:26:47 -07:00
Jean Chalard
8694130cac Merge changes Ic490fee6,If78047c3 into main am: 10353d5351
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2539630

Change-Id: I7a9c109e61759eca22722bc68b08c8f78f80ac94
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-12 11:39:09 +00:00
Jean Chalard
10353d5351 Merge changes Ic490fee6,If78047c3 into main
* changes:
  Add hidden constants for communicating about local network agents
  Use isAtLeast* from deps
2023-10-12 11:01:36 +00:00
Hansen Kurli
ed972a6fd2 Ensure nri is satisfied before returning.
When a network preference is set, the highest priority nri will
be a managed default request that disallows default networking.
In the case where there is no satisfying network,
mNoServiceNetwork is used as the satisfier instead of null.
(see computeNetworkReassignment)

mNoServiceNetwork should not be returned in any public API.
Check for the nri being satisfied before returning the satisfier
to ensure mNoServiceNetwork is not returned.

Fixes: 301222648
Test: atest FrameworksNetTests
Change-Id: I22d67a7e8d0274d8ad4f6123fbedf6d37eed18e7
2023-10-12 18:48:57 +08:00
Motomu Utsumi
12f1597804 Merge "Update mActiveIdleTimers to use netId as a key" into main am: 9b6420bc13
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2606672

Change-Id: I349e5566faba273f6acc6542cd17f37bb2cd23e0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-12 09:43:45 +00:00