Commit Graph

4429 Commits

Author SHA1 Message Date
Taras Antoshchuk
e21ceb2f19 Merge "Fix HostsideVpnTest#testExcludedRoutes" am: d42d1645cb
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1968680

Change-Id: I0c866d08d1dbd24b8466593e40ae29805167004f
2022-02-18 13:48:32 +00:00
Taras Antoshchuk
d42d1645cb Merge "Fix HostsideVpnTest#testExcludedRoutes" 2022-02-18 13:25:21 +00:00
Patrick Rohr
e3b067f523 Skip NetworkStatsServiceTest before T
NetworkStatsService was mainlined in T, so the test does not need to be
run on previous Android versions.

Test: atest CtsNetTestCases:NetworkStatsServiceTest
Change-Id: I8e69746a03ef029b1121cc8fa71e299ac12c2905
2022-02-18 09:18:20 +01:00
Maciej Żenczykowski
d1eaf3d319 Merge "Support "dumpsys connectivity trafficcontroller"" am: bce8cbabbb
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1958903

Change-Id: If18edda478aba325c4d595ea44ae3047ac30583f
2022-02-18 01:35:20 +00:00
Maciej Żenczykowski
bce8cbabbb Merge "Support "dumpsys connectivity trafficcontroller"" 2022-02-17 23:10:10 +00:00
Remi NGUYEN VAN
4eff4013cb Merge "Cleanup and refine connectivity test config" am: 3035f6c554
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1988186

Change-Id: I49671b5d47c4e7aea56ade1dcd150ef55ac4b10f
2022-02-17 22:58:07 +00:00
Treehugger Robot
8fefc6b45e Merge "DscpPolicyTest Check Kernel Version" am: 5a2f079722
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1986597

Change-Id: I9a1bde098d5fb5bf2bcad1966eaec332ad65dd64
2022-02-17 22:56:48 +00:00
James Mattis
8547fb0a87 Run CTS EthernetNetworkSpecifier in 12
EthernetNetworkSpecifier's constructor was added to @SystemApi in
Android 12. Include that release as part of running this test.

Bug: 210487893
Bug: 210485380
Test: atest CtsNetTestCasesLatestSdk
:android.net.cts.EthernetNetworkSpecifierTest

Change-Id: I1e813c38bd36b911a50137172c1f780a2ed12d1d
2022-02-17 09:37:50 -08:00
Remi NGUYEN VAN
3035f6c554 Merge "Cleanup and refine connectivity test config" 2022-02-17 09:45:39 +00:00
Lorenzo Colitti
d2bd9db36a Don't check validation state in waitForAvailable(..., Network).
The version of ConnectivityManagerTest#waitForAvailable that
takes a callback and a Network implicitly requires that the
network be validated, because it calls expectAvailableCallbacks
with validated=true.

This is incorrect because a network can become available without
being validated. In particular, testMobileDataPreferredUids is
flaky due to this problem, because it calls connectToCell, which
does not wait for validation, and then calls waitForAvailable,
which expects that the network is already validated.

Fix it by not requiring any particular validation state. This
method is only used by a few tests and they should not be
affected by this change:
- The first two calls in testSetOemNetworkPreferenceForTestPref
  happen after waiting for validation, so the network is
  validated already. The third call waits for a test network,
  and test networks are always validated.
- The first call in testSetOemNetworkPreferenceForTestOnlyPref
  waits for a test network, which is always validated. The
  second is incorrect because ensureWifiConnected does not
  wait for validation, and is fixed by this CL.
- The calls in testMobileDataPreferredUids similarly incorrectly
  assume that wifi is validated and are fixed by this CL.

Test: atest CtsNetTestCases:android.net.cts.ConnectivityManagerTest#testMobileDataPreferredUids
Change-Id: I614d0ba87c3931fcbe4011fed379e1736f5c4a44
2022-02-17 18:29:11 +09:00
Ken Chen
e6d511f785 Support "dumpsys connectivity trafficcontroller"
Enable ConnectivityService to dump BPF maps from libtraffic_controller.

Bug: 202086915
Test: adb shell dumpsys connectivity trafficcontroller
Test: atest CtsNetTestCases:ConnectivityManagerTest#testDumpBpfNetMaps
Test: run CTS in I021789813f116940d581e2c4a1fd357ff47bfa08
Change-Id: Ib0e935ee2b714ac61daceba6d13fa7a20f97f68f
2022-02-17 16:58:47 +08:00
Treehugger Robot
5a2f079722 Merge "DscpPolicyTest Check Kernel Version" 2022-02-17 07:15:11 +00:00
James Mattis
e94dfe7f49 Merge "CTS tests for EthernetNetworkSpecifier" am: 700774f34e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1973286

Change-Id: I63f1afbb659abf3a2945ca4840cf85ea9dd9d882
2022-02-17 03:28:35 +00:00
James Mattis
700774f34e Merge "CTS tests for EthernetNetworkSpecifier" 2022-02-17 03:10:36 +00:00
James Mattis
deaeefb283 CTS tests for EthernetNetworkSpecifier
Bug: 210485380
Test: atest CtsNetTestCasesLatestSdk
:android.net.cts.EthernetNetworkSpecifierTest

Change-Id: I080bc111aa57c7889a6bf9564b8fc2c1dddd944d
2022-02-16 16:46:49 -08:00
Patrick Rohr
a0f346958f Merge "Fix NetworkStatsServiceTest after adding deleteKernelTagData" am: 3226bfb631
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1968682

Change-Id: I26bc260ae6727e4e7d1a6053851681e0cee48631
2022-02-16 20:35:23 +00:00
Patrick Rohr
3226bfb631 Merge "Fix NetworkStatsServiceTest after adding deleteKernelTagData" 2022-02-16 19:59:14 +00:00
Maciej Żenczykowski
058463a731 Merge "Skip BpfExistenceTest#TestPrograms on BPF unsupported device" am: 7d30b56f06
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1987626

Change-Id: Icd154fbacbd5a48cd884ce5488bd01d922967d69
2022-02-16 12:57:56 +00:00
Remi NGUYEN VAN
e4455f91f7 Fix testing with/without connectivity module am: 3b81323e4a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1987446

Change-Id: I47ec700b2ffb852a74ec5fea0640ea95e3e223fd
2022-02-16 12:57:00 +00:00
Remi NGUYEN VAN
73da478927 Cleanup and refine connectivity test config
Remove the include for Connectivity/Tethering TEST_MAPPING as there is
no such file in that directory, add comments on ConnectivityModuleTest
usage, and skip the whole NetworkAgentTest on non-connectivity module
MTS runs.

Bug: 218611855
Test: atest CtsNetTestCasesLatestSdk
Change-Id: Id96ab8a5ae631b0c64f20faedd4a0430eb9318d4
2022-02-16 20:34:31 +09:00
Maciej Żenczykowski
7d30b56f06 Merge "Skip BpfExistenceTest#TestPrograms on BPF unsupported device" 2022-02-16 11:22:47 +00:00
Hungming Chen
0456900bf2 Skip BpfExistenceTest#TestPrograms on BPF unsupported device
BPF is supported after kernel 4.9. Skip the test on BPF
unsupported device. Ex: walleye.

Bug: 219696135
Test: atest bpf_existence_test on walleye
Change-Id: I583a858587c0501582c9e77c8b584b3136312cd5
2022-02-16 16:06:59 +08:00
Patrick Rohr
f9888898e3 Add tests for deleteKernelTagData
Test: atest NetworkStatsServiceTest
Change-Id: I6db6b79314868271f877acf2a0b21699cbf02df5
2022-02-16 14:23:30 +08:00
Remi NGUYEN VAN
3b81323e4a Fix testing with/without connectivity module
Add missing @ConnectivityModuleTest annotations to tests that cover
functionalities that were introduced in a newer connectivity module
update.

Also add CtsNetTestCasesLatestSdk to postsubmit with only APK modules
installed, and with only the connectivity/tethering module installed.
This can then be moved to presubmit to catch such issues before they are
merged.

While doing this cleanup the TEST_MAPPING file in tests/ and merge its
contents into the root TEST_MAPPING file. This does not change anything
for "postsubmit" tests as they are run independently of changes. It only
causes FrameworksNetIntegrationTests to run in presubmit on any change
in modules/Connectivity/ instead of only on modules/Connectivity/tests/
changes, which is how it should be.

Bug: 218611855
Test: TH needs to test TEST_MAPPING
Change-Id: I26629a35d8c2df3db33180ecc22d49d538ad3b8b
2022-02-16 15:22:30 +09:00
Patrick Rohr
7c52b69b3e Fix NetworkStatsServiceTest after adding deleteKernelTagData
Test: atest NetworkStatsServiceTest
Change-Id: I667a5d86e0df8505fef549e598f3b4141637fb90
2022-02-16 14:01:29 +08:00
Tyler Wear
c2926f45f2 DscpPolicyTest Check Kernel Version
Check kernel version to ensure current kernel supports
BPF logic for testcase.

Bug: 217209172
Test: atest DscpPolicyTest
Change-Id: I9e0df7d2e4eb320bd5324e2d13410bd960b75174
2022-02-16 04:53:19 +00:00
Taras Antoshchuk
7bd33a19c3 Fix HostsideVpnTests flakyness
VpnTest#checkTrafficOnVpn tests whether IP address is on VPN by
sending udp packet, ping and tcp packet to the address.
In aosp/1941233 the order of checks was changed from udp, ping, tcp
to udp, tcp, ping, which caused flaky behavior of the method.

This CL restores the order of checks as it was prior to aosp/1941233.

Bug: 214558556
Bug: 215903863
Bug: 214398658
Test: atest HostsideVpnTests --iterations 50
Change-Id: I5dc3c217b78746d5e8c13b80e5295eb6ffe5b778
2022-02-15 09:14:33 +00:00
Taras Antoshchuk
0817bb2906 Fix HostsideVpnTest#testExcludedRoutes
One of VpnTest#startVpn overloads didn't propagate "excludedRoutes"
param, due to mistake during conflict resolution in aosp/1941233.

Bug: 214398350
Test: atest HostsideVpnTests --iterations
Change-Id: Icbbe7394f1ff1f676cc671a1fa1c4449f4d585e3
2022-02-15 09:14:03 +00:00
Xin Li
bfa7b1a197 Merge "Merge sc-v2-dev-plus-aosp-without-vendor@8084891" into stage-aosp-master 2022-02-14 17:31:19 +00:00
Remi NGUYEN VAN
106569b856 Merge "Allow test+other networks to have specifiers" 2022-02-14 05:31:20 +00:00
Jean Chalard
d537aa42e1 Merge "Add new methods to redact NetworkCapabilities & LinkProperties" 2022-02-12 11:56:36 +00:00
lucaslin
c582d50b8e Add new methods to redact NetworkCapabilities & LinkProperties
Some system components like VPN need to know how to redact
NetworkCapabilities & LinkProperties that they received from
the system but need to send to third-party applications with
less privilege than themselves. To make sure the redaction is
consistent, expose system API methods to do it that are wired
to the same redaction code used by ConnectivityService.

Bug: 191413541
Test: atest CtsNetTestCases, which includes new CTS for these
Change-Id: Ia3ae4755b5192884c147d6828f96cedac000a25b
2022-02-12 15:21:13 +09:00
Treehugger Robot
5be94579d4 Merge "Refer to SDK constant defined in DevSdkIgnoreRule" 2022-02-11 09:23:02 +00:00
Chiachang Wang
137bbed860 Refer to SDK constant defined in DevSdkIgnoreRule
Refer to the same constant definition as other tests instead of
hard coding locally, so that it won't be missed as changing to
Build.VERSION_CODES.SC_V2.

Bug: 184750836
Test: atest FrameworksNetTests
Change-Id: I3c17c414d830af03e2719c5dab1a664c55f6df2a
2022-02-11 07:40:58 +00:00
Xin Li
a459e6a12d Merge sc-v2-dev-plus-aosp-without-vendor@8084891
Bug: 214455710
Merged-In: I5894450f3089b2ea105722a18ddf8f1eed1c28a0
Change-Id: If2045705da821c90705f7dd1e6944c0bb92e3289
2022-02-11 06:57:49 +00:00
Treehugger Robot
0fc2ec6d68 Merge "remove unneeded inclusions of libbpf_android" 2022-02-10 19:50:34 +00:00
Robert Horvath
3a33495992 Merge "Add Low Power Standby test to NetworkManagementServiceTest" 2022-02-10 11:17:44 +00:00
Maciej Żenczykowski
11ab996252 remove unneeded inclusions of libbpf_android
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I6aedf507e09effd9076de85a0acc7aaf1b8e4a1e
2022-02-09 22:10:22 -08:00
Chiachang Wang
84ad04f768 Merge "Change naming of excludeLocalRoutes" 2022-02-10 00:50:30 +00:00
Patrick Rohr
6b5b7b40d8 Merge changes from topic "bandwidth-limiting"
* changes:
  Add bandwidth limiting to CS
  Add setting that controls network rate limit
2022-02-09 18:00:04 +00:00
Jean Chalard
ec05b337aa Merge "Pass the NetworkAgentConfig to NetworkMonitor." 2022-02-09 16:55:59 +00:00
Patrick Rohr
2857ac4dd0 Add bandwidth limiting to CS
Adds ingress rate limiting functionality to ConnectivityService. The tc
rate limit is installed before we tell netd about the interface, and
removed after the network is removed from netd. When the setting
changes, the old rate limit needs to be removed before a new one can be
added (unfortunately, we cannot use NLM_F_REPLACE when configuring the
tc-police filter).

Currently, this functionality is always enabled, but may or may not work
based on kernel support.

Bug: 157552970
Test: atest FrameworksNetTests:ConnectivityServiceTest
Change-Id: I4e64b2c40490f061e42b40a1b1b3a6618c3d1a87
2022-02-09 14:46:26 +01:00
Patrick Rohr
a20843638f Add setting that controls network rate limit
The INGRESS_RATE_LIMIT_BYTES_PER_SECOND setting controls the rate limit
for internet networks. If set to -1, no rate limit applies.  There is
one global rate limit that will be applied to all networks with
NET_CAPABILITY_INTERNET.

Test: atest ConnectivitySettingsManagerTest
Bug: 157552970
Change-Id: Ia82aa867686d484ce46734f76d4a48bf864eff84
2022-02-09 14:46:26 +01:00
Treehugger Robot
0ad3becd60 Merge changes from topic "split-pre-jarjar"
* changes:
  Enable framework-connectivity-t-pre-jarjar for service-t
  Split out connectivity-t-pre-jarjar and tests
2022-02-09 12:54:46 +00:00
Remi NGUYEN VAN
2ba9dbe163 Split out connectivity-t-pre-jarjar and tests
The pre-jarjar variant is necessary so that service-t can depend on
hidden symbols in framework-t that reference (for example as parameter)
classes that are jarjared.
Without this, when depending on framework-connectivity-tiramisu.impl,
service-connectivity-t would see post-jarjar symbols that do not match
the classnames it uses in its code.

Also split FrameworksNetTestsLib so that the same jarjar rules can be
applied between the tests and the module, avoiding different errors
between FrameworksNetTests and ConnectivityCoverageTests.

Ignore-AOSP-First: Avoiding conflicts; cherry-pick will follow
Bug: 204830222
Test: m
Change-Id: I3d0c081c4a7422e128beee11c0156f01b0377c96
Merged-In: I3d0c081c4a7422e128beee11c0156f01b0377c96
2022-02-09 18:29:30 +08:00
Chiachang Wang
f890874970 Change naming of excludeLocalRoutes
Address API review feedback to change naming of
setExcludedLocalRoutesVpn and getter.

Bug: 217742354
Test: atest FrameworksNetTests
Change-Id: I57bbf55c7aba1c86ec8687d2431a50b37e63c6d0
2022-02-09 15:50:06 +08:00
Chalard Jean
d490072cd6 Pass the NetworkAgentConfig to NetworkMonitor.
When the network is a VPN, NetworkMonitor needs to know whether
the VPN requests validation, and that information is stored in
NetworkAgentConfig. Pass it.

Test: FrameworksNetTests
Change-Id: I3616f0796b69ce054d92213aafdef43ba7041596
2022-02-09 15:19:38 +09:00
Jean Chalard
4b66d4e244 Merge "Add and implement API for VpnManagers to request validation" 2022-02-09 06:03:45 +00:00
Michael Groover
0762151207 Merge "Marking test receiver as exported." 2022-02-09 05:38:41 +00:00
Chiachang Wang
865511a8c4 Add and implement API for VpnManagers to request validation
This adds a new API that lets VPN apps using VpnManager request
that the platform run its basic validation check on the resulting
network.

Bug: 184750836
Test: atest FrameworksNetTests
Change-Id: I00092eee857d3e33529b19461cfd5dd060a0fe20
2022-02-08 22:47:26 +09:00