Commit Graph

92528 Commits

Author SHA1 Message Date
Anton Kulakov
0c22e7e12a Merge "Revert "Simplify addRoutesToLocalNetwork calls"" into main am: 673d97b919
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2786124

Change-Id: If4e8fc92ae92fb7356dcaca234404a94c0be49a5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-14 08:58:42 +00:00
Anton Kulakov
673d97b919 Merge "Revert "Simplify addRoutesToLocalNetwork calls"" into main 2023-10-14 08:19:27 +00:00
Patrick Rohr
6e53f640d7 Merge "Fix broken documentation in Connectivity" into main am: 0eab476f7a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2786128

Change-Id: I36928431b915ac225bf40f57426b3a90c0fd3cb0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-13 20:02:08 +00:00
Patrick Rohr
0eab476f7a Merge "Fix broken documentation in Connectivity" into main 2023-10-13 19:30:52 +00:00
Treehugger Robot
46305cbb63 Merge "Add additional overriding methods to signature files" into main am: d2d3b5dd88
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2745461

Change-Id: I6244b3fcdfd638132d5010fa46f8783db03f07c4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-13 15:38:15 +00:00
Anton Hansson
5ac6c0b05b Fix broken documentation in Connectivity
EthernetManager is @SystemApi, so cannot be referenced from public
API.

Bug: 303184203
Test: m docs
Change-Id: Ib5cc07c89b4ecfdeae704da131ebb307816e35fa
2023-10-13 15:25:26 +00:00
Anton Kulakov
316346be6e Revert "Simplify addRoutesToLocalNetwork calls"
Revert submission 2777667

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

Reverted changes: /q/submissionid:2777667

Bug: 305187495

Change-Id: I516d40b20d775e9c61b2f825bc094329d016d0c3
2023-10-13 15:15:50 +00:00
Treehugger Robot
d2d3b5dd88 Merge "Add additional overriding methods to signature files" into main 2023-10-13 15:05:40 +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
Paul Duffin
ec71811f1f Merge "Add additional overriding methods to signature files" into udc-mainline-prod 2023-10-13 08:23:22 +00:00
Chalard Jean
cf70df3e9b Simplify addRoutesToLocalNetwork calls
There are only three calls to this method, and two of them
are with a list of 1 address which means it's simpler inlined.

The last call will be replaced with calls to RouteController
in a followup, meaning we addRoutesToLocalNetwork can be removed.

Test: RouterAdvertisementDaemonTest
      NetdUtilsTest
Change-Id: I3b6ee1db40f09954b336321000735a66306bf000
2023-10-13 16:19:25 +09: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
Paul Duffin
e531db3c9a Add additional overriding methods to signature files
This change adds overriding methods that are essential to compile the
stubs generated from the signature files.

More information and the background for this change is available at
go/add-overriding-one-pager.

Ignore-AOSP-First: Needs to be done in udc-mainline-prod first
Test: m checkapi
Bug: 299366704
Change-Id: Idba307148fd9afa87bfb7e0c89e00d9bd97ec204
2023-10-12 21:56:21 +00:00
Paul Duffin
b3c3f2e9d0 Add additional overriding methods to signature files
This change adds overriding methods that are essential to compile the
stubs generated from the signature files.

More information and the background for this change is available at
go/add-overriding-one-pager.

Test: m checkapi
Bug: 299366704
Change-Id: Idba307148fd9afa87bfb7e0c89e00d9bd97ec204
2023-10-12 19:21:07 +01: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
Hansen Kurli
48c14686a3 Add testLockdownVpn that mocks platform VPN.
Add a test for lockdown vpn that uses TYPE_IKEV2_IPSEC_PSK and
mocks platform VPN by override in startLegacyVpnPrivileged().
In the context of ConnectivityService, setVpnDefaultForUids()
is the main interaction.

Refactor testLegacyLockdownVpn to take a VpnProfile and assert
behaviors with and without setVpnDefaultForUids().
This includes:
    1. Updating callback asserts and assertActiveNetworkInfo to
       reflect setVpnDefaultForUids().
    2. Adding TODOs where mCm.getActiveNetworkInfo() returns
       unexpected values.

Bug: 230548427
Test: atest FrameworksNetTests
Change-Id: Ida4a4bc745af5ba2fc251795b2ffca56ead79b7f
2023-10-12 18:48:24 +08:00
Paul Duffin
886a679eb5 Merge "Revert "Ignore @FlaggedApi annotated API in udc mainline branch"" into udc-mainline-prod 2023-10-12 10:23:25 +00: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
Motomu Utsumi
9b6420bc13 Merge "Update mActiveIdleTimers to use netId as a key" into main 2023-10-12 09:10:22 +00:00
Motomu Utsumi
6473aede2e Revert "Ignore @FlaggedApi annotated API in udc mainline branch"
This reverts commit 9ee37a0e60.

Reason for revert: API files are not correct in udc-mainline-prod

Change-Id: Ief0a79883bcc2c5493807c548cb71ef655abed23
2023-10-12 08:40:37 +00:00
Paul Hu
b79fb66be2 Merge "Stop the created handler threads on the tests" into main am: 0b5d785096
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2784088

Change-Id: I2e9a1ab99077c3e6dd3036b87f97239581a20f46
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-12 07:47:58 +00:00
Paul Hu
0b5d785096 Merge "Stop the created handler threads on the tests" into main 2023-10-12 07:13:30 +00:00
Chalard Jean
d6f4efb1a8 Add hidden constants for communicating about local network agents
Test: FrameworksNetTests
Change-Id: Ic490fee6ee70d74acff0a290199b2946817173d0
2023-10-12 13:30:49 +09:00
Chalard Jean
5efbcf7bab Use isAtLeast* from deps
CSTest and CSAgentWrapper need to agree on what the current
version is

Test: CSTest*
Change-Id: If78047c36ce213a531207d25b410e870691fbb98
2023-10-12 13:30:49 +09:00
Jean Chalard
de72505109 Merge changes Ibb8d33b7,Ie168fe1f,I9f699b63 into main am: 02193c0cce
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2775660

Change-Id: I08e845ac61b6e37e88eacc3f48964742da708b61
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-12 02:48:04 +00:00
Paul Hu
ebbbf8f470 Stop the created handler threads on the tests
The created handler thread will stay there for a while until
all the tests are finished. This is considered as a leakage
which will take the resource from the devices. In low end
devices, this may possibly impact the performance. The created
threads should be closed explicitly.

Test: atest ConnectivityCoverageTests ConntrackSocketTest
Change-Id: Ic1beb2a210e7c8c80c66fc9e0727c47599150672
2023-10-12 10:25:03 +08:00
Jean Chalard
02193c0cce Merge changes Ibb8d33b7,Ie168fe1f,I9f699b63 into main
* changes:
  Prepare exposing Network{Request,Caps}.forbiddenCapabilities
  Add a keep connected for test reason
  Improvements to CSTest : legacy type, wait for LOST, permissions
2023-10-12 02:14:52 +00:00
Jihoon Kang
9df878785f Merge "Prepare for keeping concrete overrides of abstract methods" into main am: 415773ed06
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2781647

Change-Id: I33c7e6c3198e863941ee3a03175dc73cc76a6ea5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-11 21:39:39 +00:00
Jihoon Kang
415773ed06 Merge "Prepare for keeping concrete overrides of abstract methods" into main 2023-10-11 21:02:18 +00:00
Hansen Kurli
d6aef6b6c3 Merge changes Ib24809ec,Id9d26435 into main am: 270813c4c5
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2727558

Change-Id: Ic0fb2ca5c7aaebf9ac6597f1c19e71b7979339a8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-11 12:35:59 +00:00
Hansen Kurli
270813c4c5 Merge changes Ib24809ec,Id9d26435 into main
* changes:
  Remove the fail case on IPv6 in testLockdownVpn
  Remove LockdownVpnTracker from testLegacyLockdownVpn
2023-10-11 12:03:37 +00:00
Treehugger Robot
4a01efa882 Merge "Add TrunkStable.bp" into udc-mainline-prod 2023-10-11 10:13:40 +00:00
Chalard Jean
cf7dbcae41 Prepare exposing Network{Request,Caps}.forbiddenCapabilities
This is useful going forward in particular because there will
be a default forbidden capability for LOCAL_NETWORKS. This
means it will be useful to be able to remove it.

It is also generally useful and we have been wanting to open
this API to the public, so this is a good opportunity to do so.

Test: new tests for NetworkRequest
      NetworkCapabilitiesTest already has tests because it
      already was @SystemApi
Change-Id: Ibb8d33b799f2d274326fd9cd0b05a2c33a18032a
2023-10-11 17:02:52 +09:00
Chalard Jean
c517fb1247 Add a keep connected for test reason
This has been sorely needed for a while. Instead of filing requests
for each of your networks in a CSTest, which is fiddly at best and
sometimes almost impossible (because you can't single out the network),
you can now add this flag and be done with it.

Test: CSKeepConnectedTest
Change-Id: Ie168fe1f3a17de035fdf05e3d6580d3262a3448e
2023-10-11 17:02:52 +09:00
Chalard Jean
026ca940d9 Improvements to CSTest : legacy type, wait for LOST, permissions
• Make sure all Agents have a legacy type. This is necessary to
  avoid crashes in LegacyNetworkTracker
• Wait for LOST when disconnecting a network
• Make sure the test package sees its own permissions (importantly
  it can't see background networks otherwise, because it lacks
  CHANGE_NETWORKING_STATE)

Test: in the followup
Change-Id: I9f699b6372a8fe0d5bcd5310d8f35f72e48a6c61
2023-10-11 17:02:51 +09:00
Motomu Utsumi
d590d88294 Add TrunkStable.bp
All the branches except udc-mainline-prod have TrunkStable.bp.
So this CL adds this file to avoid conflicts.
TrunkStable.bp is not included by Android.bp in udc-mainline-prod.
So, this CL is a no-op.

AOSP-first: TrunkStable.bp exists in aosp
Test: TH
Merged-In: Ib69d2fdc1d73b36a08a3d8ae1f2c45b2bcffae64

Change-Id: Ib3fe0774086ab5531f0e4d776da23667d32daad4
2023-10-11 06:56:09 +00:00
Maciej Żenczykowski
7dd74423c4 build netbpfload into the tethering apex am: a2a3d754a6
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2781564

Change-Id: I2551e588e692428c67dc6a48a563e92e693a2d23
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-11 04:07:43 +00:00
Maciej Żenczykowski
a2a3d754a6 build netbpfload into the tethering apex
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Id68aece26115808c2b1b795b9395208f5066f87c
2023-10-10 16:51:01 -07:00
Maciej Żenczykowski
ce8805af92 Merge changes from topic "netbpfload" into main am: 9c01dd494d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2779973

Change-Id: I18eac603991a538352700abbc3780d726477a24c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-10 17:43:12 +00:00
Chalard Jean
ef86df81d1 Reword a comment for accuracy am: f70919fbec
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2780320

Change-Id: Iefc882167d6bedc60da0ceac4dc522280de3ee0a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-10 17:42:36 +00:00
Maciej Żenczykowski
9c01dd494d Merge changes from topic "netbpfload" into main
* changes:
  netbpfload: remove netbpfload.rc
  netbpfload: remove support for limiting selinux contexts
  netbpfload: do not create /sys/fs/bpf/loader subdir
  type safety for 'bool downstream'
  type safety for 'bool updatetime'
2023-10-10 17:23:50 +00:00