Commit Graph

10094 Commits

Author SHA1 Message Date
markchien
b582c81ee8 Fix tethering unit test fail in R am: 9eac605333
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1711436

Change-Id: I4a6c05d5b12ef159367e70df661fa2d386124fa9
2021-05-20 05:54:03 +00:00
markchien
9eac605333 Fix tethering unit test fail in R
The change aosp/1708088 break tethering unit test in R.

Bug: 187946226
Test: atest TetheringTests in R and S
Change-Id: I4eb4b757f6d7cd3458964c81310dcf0687a4f091
2021-05-19 22:58:36 +08:00
Treehugger Robot
82e910ecc5 Merge "[VCN21.1] Verify capability is not added if specifier is present" am: 20d9f4722e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1705134

Change-Id: Iae49fd663e9b90e935b9065ef60561f2b4c55439
2021-05-18 09:36:16 +00:00
Treehugger Robot
20d9f4722e Merge "[VCN21.1] Verify capability is not added if specifier is present" 2021-05-18 08:35:06 +00:00
Mark Chien
c59d6fa12d Merge "Check whether feature is enabled by compare with apex version" am: 84a8a13a92
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1708088

Change-Id: Iefbd6fa6a061614b83d115219f8939dee8794bb7
2021-05-18 03:37:13 +00:00
Mark Chien
84a8a13a92 Merge "Check whether feature is enabled by compare with apex version" 2021-05-18 03:09:20 +00:00
junyulai
f15fb56f73 [VCN21.1] Verify capability is not added if specifier is present
Test: atest NetworkRequestTest#testBypassingVcn
Bug: 176939355
Change-Id: I3fdd7a08ac9fd667633b68dc935abce024dd3a4d
2021-05-17 07:03:53 +00:00
Mark Chien
9015e276aa Merge "Test mts against last stable api level" am: a59a146b36
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1686012

Change-Id: I51562dc48242c7d2f2f53f7f9fe7b5797e945ede
2021-05-14 09:36:00 +00:00
Mark Chien
a59a146b36 Merge "Test mts against last stable api level" 2021-05-14 09:00:11 +00:00
markchien
a3ef48117f Check whether feature is enabled by compare with apex version
Replace the isFeatureEnabled function which is check with apex version.

Bug: 187946226
Test: Set device config flag and check the result
Change-Id: Iba44a01e2fdd0698dcb338ea4a8fe8147cbaa7dd
2021-05-14 16:56:33 +08:00
Treehugger Robot
c7ea77ce6a Merge "Re-enable check for VpnTransportInfo session ID." am: 6748f93e56
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1705135

Change-Id: I0de41fe2ba6d2bc691b5693a81da368ae5e0e025
2021-05-14 06:10:30 +00:00
Treehugger Robot
6748f93e56 Merge "Re-enable check for VpnTransportInfo session ID." 2021-05-14 05:58:35 +00:00
Treehugger Robot
e7bb625eaf Merge "Don't run testRequestBackgroundNetwork in instant app mode" am: 3531b188ce
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1695289

Change-Id: Ib447d41a24fedf2b23881653c23674f526a37c65
2021-05-14 04:37:49 +00:00
Treehugger Robot
3531b188ce Merge "Don't run testRequestBackgroundNetwork in instant app mode" 2021-05-14 04:09:43 +00:00
Nucca Chen
72bd34e343 Merge "bpf: Add interface index to BPF devmap" am: aa10ddfa6f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1703125

Change-Id: Ic4bcba98c1f1e43314a0a9797b427fee4bb0c20e
2021-05-14 02:46:15 +00:00
Junyu Lai
b8c3c59504 Merge "[SP32.3] No-op refactoring of OffloadControllerTest" am: 4ec15d5d71
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1683006

Change-Id: I97fba52572d7244106b3ee3770431939804dbc5a
2021-05-14 02:46:08 +00:00
Nucca Chen
aa10ddfa6f Merge "bpf: Add interface index to BPF devmap" 2021-05-14 02:45:38 +00:00
Junyu Lai
4ec15d5d71 Merge "[SP32.3] No-op refactoring of OffloadControllerTest" 2021-05-14 02:18:12 +00:00
Mark Chien
bf74c05038 Merge "Fix some TetheringCoverageTest failure" am: 08b89743de
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1699426

Change-Id: Id3b14e197d1cd42a2a0dfa4c4c7cef2d052cbf9c
2021-05-13 16:00:40 +00:00
Lorenzo Colitti
8f67bdec5a Re-enable check for VpnTransportInfo session ID.
This check was commented out because VpnTransportInfo was not
correctly propagated to ConnectivityService. This is now fixed.

Bug: 183938194
Test: atest CtsNetTestCases:NetworkAgentTest
Change-Id: Iab9987c8b58487ee44d8479b02e030c7e1e4465f
2021-05-14 00:47:55 +09:00
Mark Chien
08b89743de Merge "Fix some TetheringCoverageTest failure" 2021-05-13 15:46:02 +00:00
Junyu Lai
784f54eefb Merge "No-op Refactoring of startTrackDefaultNetwork" am: 7fecf6a017
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1697371

Change-Id: I3a03e19384ba021aa176f681e7b288f5bde59638
2021-05-13 14:51:34 +00:00
Junyu Lai
7fecf6a017 Merge "No-op Refactoring of startTrackDefaultNetwork" 2021-05-13 14:32:00 +00:00
Chiachang Wang
650927c734 Merge "Add test for ConnectivityManager.setGlobalProxy()" am: 78c1663ba3
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1688272

Change-Id: Iaf40a7004a6305ad86b985695bfe4a9ee9038c96
2021-05-13 09:44:29 +00:00
Chiachang Wang
78c1663ba3 Merge "Add test for ConnectivityManager.setGlobalProxy()" 2021-05-13 09:30:25 +00:00
junyulai
b95083ea6a No-op Refactoring of startTrackDefaultNetwork
While the actual part that track default request is inside
UpstreamNetworkMonitor, instead of passing it from Tethering,
move it into counter-part CL and use it from
UpstreamNetworkMonitor.

Since the current code is replaced by registerSystemDefaultCallback
in Android S, implement it inside the api30 shim implementation
to provide an unified interface to tethering.

Test: atest TetheringCoverageTests
Bug: 185952829
Change-Id: Iaf21b6b662aa6aba79c2b75379128b8523f81f02
2021-05-13 14:07:40 +08:00
Lucas Lin
71d233730c Merge "Define PRIVATE_DNS_MODE_OPPORTUNISTIC locally" am: d56f4a700b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1696705

Change-Id: I05089bdc7433ec244fe9be8cbc4e9afd40da0f27
2021-05-12 17:23:46 +00:00
Lucas Lin
d56f4a700b Merge "Define PRIVATE_DNS_MODE_OPPORTUNISTIC locally" 2021-05-12 17:09:50 +00:00
markchien
075432d7c9 Fix some TetheringCoverageTest failure
1. Fix no ACCESS_NETWORK_STATE permission problem when accessing
EthernetManager#getAvailableInterfaces API from S.
2. Fix some wrong jarjar rules.

Bug: 187371740
Test: atest TetheringCoverageTest on R platform
Change-Id: I203db6c4ea2e13d8fb5bc2db7ee877ccbb97b761
2021-05-12 14:12:10 +00:00
markchien
7193a1b30e Test mts against last stable api level
Create *LatestSdk variant build target which have target sdk specify
to allow test apk install to released platform.

Bug: 182211575
Test: test S MtsTetheringTest in R device
Change-Id: I4d5c5e8c3d74993a67380e0211da31884cbf8792
2021-05-12 22:11:04 +08:00
Hungming Chen
3feb782282 bpf: Add interface index to BPF devmap
Add upstream and downstream interface index to BPF map and rename the
BPF map name from xdp_devmap to dev.

$ adb shell dumpsys tethering
    Device map:
      ifindex (iface) -> ifindex (iface)
        21 (21) -> 21 (21)
        25 (25) -> 25 (25)
        12 (rmnet_data2) -> 12 (rmnet_data2)

$ adb shell ip addr
12: rmnet_data2 ..
21: wlan1 ..
25: rndis0 ..

$ adb shell ls /sys/fs/bpf/tethering
map_offload_tether_dev_map

Test: atest TetheringCoverageTests

Change-Id: Ic49965f3374d9e196ee672ec2f0e9e08f3847deb
2021-05-12 19:57:18 +08:00
Lorenzo Colitti
9d288a6904 Remove dead code. am: 2422319cb7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1703126

Change-Id: I7c3990ac8943e30fae0508a1bda55db02e019a90
2021-05-12 10:41:17 +00:00
Lorenzo Colitti
c0f1bed8c5 Remove mPublicSync. am: 94311aa902
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1678387

Change-Id: I72b34f951a036a7baa1f1f84a55820aa10970198
2021-05-12 10:41:16 +00:00
Lorenzo Colitti
c7a163bae8 Make Tethering#dump asynchronous. am: 5f729e14a3
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1678386

Change-Id: Ifc7372870a3bf12251a909d84e1c9174531a87ec
2021-05-12 10:41:15 +00:00
Lorenzo Colitti
946da7b575 Skip presubmit for IPsec transport mode IPv6 TCP tests. am: b54bdabe5a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1705126

Change-Id: Iefb634b98f1f7e4420f40b80740eaaef4329e66e
2021-05-12 10:41:11 +00:00
Lorenzo Colitti
2422319cb7 Remove dead code.
Remove a few legacy methods that have no callers.

Test: m
Change-Id: I499e940dc98453194fc528d65a89696471ad8bdd
2021-05-12 17:35:49 +09:00
Lorenzo Colitti
94311aa902 Remove mPublicSync.
This is no longer necessary as all the methods that take it are
running on on the handler thread, either in Tethering itself or
on the state machine thread in IpServer, which runs on the same
thread as Tethering.

Specifically:
- interfaceStatusChanged, interfaceAdded, interfaceRemoved,
  interfaceLinkStateChanged: run from mNetdCallback, which always
  posts them to mHandler.
- setWifiTethering: only called by enableTetheringInternal, which
  is called by the following:
  - startTethering, stopTethering: via lambda posted to mHandler
  - IpServerCallback#requestEnableTethering: called by IpServer
    while processing a command.
- setEthernetTethering: only called by enableTetheringInternal.
- EthernetCallback: runs on mExecutor, which posts to mHandler.
- getLastTetherError: only used by the test. Renamed to
  getLastErrorForTest to ensure no other callers.
- sendTetherStateChangedBroadcast: called only by
  notifyInterfaceStateChange, which is called only by
  - IpServerCallback#updateInterfaceState, which is called only
    by sendInterfaceState, which is called by various IpServer
    state enter methods.
- notifyLinkPropertiesChanged: called only by
  IpServerCallback#updateLinkProperties, which is only called by
  IpServer#sendLinkProperties, which is only called by:
  - Code that processes CMD_IPV6_TETHER_UPDATE
  - IpServer#handleNewPrefixRequest: only called when processing
    CMD_NEW_PREFIX_REQUEST.
  - IpServer#sendInterfaceState (see above)
- handleWifiApAction, handleWifiP2pAction: only called by
  mStateReceiver, which runs on the handler thread
- tether(String, int): called by:
  - tether(String, IIntResultListener): posted to mHandler
  - changeInterfaceState: called by:
    - EthernetCallback (see above)
    - enableWifiIpServingLocked: called by handleWifiApAction and
      handleWifiP2pAction (see above)
    - tetherMatchingInterfaces: only called by handleUsbAction,
      which is run from mStateReceiver on the handler thread.
- untether(String): called by:
  - untether(String, IIntResultListener): posted to mHandler
  - changeInterfaceState (see above)
- setUsbTethering: called by:
  - setUsbTethering(boolean, IIntResultListener): posted to mHandler
  - enableTetheringInternal (see above)
- setNcmTethering: called by enableTetheringInternal (see above)
- getTetheredIfaces: called only by TetheringTest. Renamed to
  getTetheredIfacesForTest to ensure no other callers.
- getErroredIfaces: unused, deleted in this CL
- getTetheredIfaces: called by:
  - isTetheringActive: called by onUserRestrictionsChanged, which
    is only called by mStateReceiver
  - TetheringTest
- dump(): changed to run on handler thread
- upstreamWanted: called by
  - TetherModeAliveState#enter
  - TetherModeAliveState#updateUpstreamWanted, which is called
    only by TetherModeAliveState#processMessage.

Test: atest TetheringCoverageTests
Test: enabled/disabled hotspot, USB tethering
Change-Id: Id49d33f027b8df4c97fda480ff239c0ba90bb96a
2021-05-12 17:35:49 +09:00
Lorenzo Colitti
5f729e14a3 Make Tethering#dump asynchronous.
This is in preparation for removing mPublicSync.

Test: m
Test: adb shell dumpsys tethering
Test: atest TetheringTests TetheringIntegrationTests
Change-Id: Ib2c9d0bff23614f76c8e075d32cb03412d3d21f7
2021-05-12 17:35:49 +09:00
Lorenzo Colitti
b54bdabe5a Skip presubmit for IPsec transport mode IPv6 TCP tests.
These tests are currently broken due to what appears to be an
upstream regression affecting 5.10 kernels, and are causing
all networking CLs to fail presubmit.

Skip them in presubmit until the regression is fixed. The tests
will still fail when run manually or in postsubmit.

Bug: 186608065
Test: atest CtsNetTestCases:android.net.cts.IpSecManagerTest
Change-Id: Ib78e13ace62a0addddff0a2d17b7f393a4cc4f87
2021-05-12 17:35:49 +09:00
Hungming Chen
dc0ec70f3f Fix attaching program failure on kernel 5.10 am: 3c94994650
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1697147

Change-Id: I67cee508cb60f424b01c84fc729b892693905e95
2021-05-06 07:14:29 +00:00
Hungming Chen
3c94994650 Fix attaching program failure on kernel 5.10
Attach BPF program may be failed with the netlink error message
"Invalid argument". Per debug kernel trace, it is failed in
comparing the kind name in tc_new_tfilter.

Log:
05-05 19:44:42.329  1073  2332  2332 W tc_new_tfilter:
Specified filter kind does not match existing one

Test: enable usb tethering and check the follows

$ adb shell tc filter show dev <upstream, downstream> ingress
filter protocol ipv6 pref 1 bpf chain 0
filter protocol ipv6 pref 1 bpf chain 0 handle 0x1
prog_offload_schedcls_tether_upstream6_ether:[*fsobj]
direct-action not_in_hw id 3 tag 94ca9b12972fdea8
filter protocol ip pref 2 bpf chain 0
filter protocol ip pref 2 bpf chain 0 handle 0x1
prog_offload_schedcls_tether_upstream4_ether:[*fsobj]
direct-action not_in_hw id 9 tag 992aa9bfd0503457
filter protocol ipv6 pref 1 bpf chain 0
filter protocol ipv6 pref 1 bpf chain 0 handle 0x1
prog_offload_schedcls_tether_downstream6_rawip:[*fsobj]
direct-action not_in_hw id 4 tag 7fb60e556b8f3be7
filter protocol ip pref 2 bpf chain 0
filter protocol ip pref 2 bpf chain 0 handle 0x1
prog_offload_schedcls_tether_downstream4_rawip:[*fsobj]
direct-action not_in_hw id 6 tag e41426095404fb64

Change-Id: I471a2e34c626a3737cbd2754e4d1b3000bcf6ba6
2021-05-06 02:52:07 +00:00
lucaslin
09f1245d4a Define PRIVATE_DNS_MODE_OPPORTUNISTIC locally
The type of ConnectivityManager#PRIVATE_DNS_MODE_OPPORTUNISTIC
has changed from String to int, but the String definition is still
needed to update to Settings.Global.PRIVATE_DNS_MODE, so the
simplest way is to define one locally.

Bug: 185311744
Test: atest CtsNetTestCases
Change-Id: Iafcd861714d8aca44cede658ed630f9d5afd5e59
Merged-In: Iafcd861714d8aca44cede658ed630f9d5afd5e59
    (Cherry-picked from ag/14232792)
2021-05-05 02:36:44 +00:00
junyulai
f3496591f9 Don't run testRequestBackgroundNetwork in instant app mode
Per documentation at the sdk website, the instant app mode
does not have the permission that is needed to get test network.
Thus, ignore test in instant app mode.

Test: atest CtsNetTestCases:android.net.cts.ConnectivityManagerTest#testRequestBackgroundNetwork \
      --instant
Bug: 185927087
Change-Id: Ic7bf230349c2a17ac485a72416b294dba81dac06
2021-05-04 18:33:29 +08:00
junyulai
ba4b6d1bd4 [SP32.3] No-op refactoring of OffloadControllerTest
This is necessary change for minimize the code size when
repeatedly restarting OffloadController in subsequent
patches.

Test: atest TetheringTests
Bug: 149467454
Merged-In: I0b02d01cd8749d81c9d020dee7fdb4f80e18ae98
Change-Id: I0b02d01cd8749d81c9d020dee7fdb4f80e18ae98
  (cherry-picked from ag/14234078)
2021-04-29 18:19:55 +08:00
Chiachang Wang
38b7a40643 Add test for ConnectivityManager.setGlobalProxy()
ConnectivityManager.setGlobalProxy() requires NETWORK_STACK
permission. Add test to verify exception thrown if caller has
no permission.

Bug: 186061922
Test: atest CtsNetTestCases CtsNetTestCasesLatestSdk
Change-Id: I87e2e6a878bd538b2e8c6f72f44335746151a9a7
2021-04-28 09:27:49 +00:00
Treehugger Robot
1c4103c150 Merge "Add native coverage listener to tethering coverage test" am: e6bafe29b0
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1687651

Change-Id: I895dd9b7c2a9fdf1f9e9dae18e54a5fe635d954f
2021-04-27 19:08:11 +00:00
Treehugger Robot
e6bafe29b0 Merge "Add native coverage listener to tethering coverage test" 2021-04-27 18:35:29 +00:00
Sarah Chin
4d9f226837 Merge "Add tests for NetCapability#getCapabilityCarrierName" am: 45fa6bd811
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1683350

Change-Id: I90d74f4ec5f6b7bbe81862484f50fc7fb83ae134
2021-04-27 18:17:55 +00:00
Sarah Chin
45fa6bd811 Merge "Add tests for NetCapability#getCapabilityCarrierName" 2021-04-27 17:58:12 +00:00
markchien
b23e912805 Add native coverage listener to tethering coverage test
This allows the coverage tests to manually trigger native coverage
collection, as a workaround for collection not being triggered
automatically by the coverage infrastructure.

Bug: 185202279
Test: atest TetheringCoverageTests
Change-Id: I619fc267cf1743dd2218e3dd42546b0d4e9da193
2021-04-27 16:48:25 +00:00