Commit Graph

1379 Commits

Author SHA1 Message Date
Chalard Jean
d568791283 Fix a bug where a spurious capabilities callback is sent.
When a VPN connects and it has any underlying network (which
means almost always, because it will take the default network
if it doesn't declare any), it has default capabilities and
will only take the capabilities of its underlying network
as part of an update happening after making the network
available but before the rematch can take place. This in turn
causes the capabilities callback sent as part of the rematch
to be spuriously sent.

Test: FrameworksNetTests. Also tested together with a
      followup that adds tests with drive-by coverage for this.
Bug: 150570873
Change-Id: Id7d8bba486bada1a7ba5b0f152d2aa02e407f249
2020-05-07 12:07:03 +09:00
junyulai
d33735c952 [SM10] Adopt helper class to monitor RAT type change per sub
Test: atest NetworkStatsServiceTest
Bug: 146415925
Change-Id: I45c3aa9046b316c8cd0943543d620a22e4afefd1
Merged-In: I45c3aa9046b316c8cd0943543d620a22e4afefd1
(cherry picked from commit 219faff07bdc58c14fe58fc525e86383db1f8167)
2020-05-05 18:37:29 +08:00
Remi NGUYEN VAN
cc9f73cad3 Merge "Address comments on NetworkStack AIDL v6" into rvc-dev 2020-04-30 06:02:32 +00:00
Chiachang Wang
bd16241678 Filter debug entries for each vpn
NetworkStats calculation needs to filter out debug entries to
prevent over counting. While NetworkStatsFactory migrates data
usage over a VPN to the TUN network, NetworkStatsFactory does
not filter out debug entries per vpn which will cause debug
entries left and cause exception.

Bug: 152678151
Test: atest com.android.server.net.NetworkStatsFactoryTest
      and verify no exception
Change-Id: I3525edc385b07858b48c7add2d331c4b5a2e84ad
Merged-In: I3525edc385b07858b48c7add2d331c4b5a2e84ad
2020-04-30 02:39:15 +00:00
Chiachang Wang
3cb1e03082 Add test prefix into test cases
Bug: 152678151
Test: atest com.android.server.net.NetworkStatsFactoryTest
Change-Id: I6e18915e383ac20072cb238d0136d7a8e4ceb811
Merged-In: I6e18915e383ac20072cb238d0136d7a8e4ceb811
2020-04-30 02:38:18 +00:00
Chiachang Wang
6c3df199cd Merge changes I3525edc3,I6e18915e am: 7752ddf0b7 am: 098a24b8d4
Change-Id: I85b8798fc82873d22c338937bb61092fbde259e6
2020-04-29 09:24:10 +00:00
Chiachang Wang
1d5c290e38 Filter debug entries for each vpn
NetworkStats calculation needs to filter out debug entries to
prevent over counting. While NetworkStatsFactory migrates data
usage over a VPN to the TUN network, NetworkStatsFactory does
not filter out debug entries per vpn which will cause debug
entries left and cause exception.

Bug: 152678151
Test: atest com.android.server.net.NetworkStatsFactoryTest
      and verify no exception
Change-Id: I3525edc385b07858b48c7add2d331c4b5a2e84ad
2020-04-29 15:07:45 +08:00
Chiachang Wang
88fa813bd7 Add test prefix into test cases
Bug: 152678151
Test: atest com.android.server.net.NetworkStatsFactoryTest
Change-Id: I6e18915e383ac20072cb238d0136d7a8e4ceb811
2020-04-29 13:44:50 +08:00
Remi NGUYEN VAN
f577197908 Address comments on NetworkStack AIDL v6
Address issues found during AIDL review:
 - Rename clientAddr to singleClientAddr
 - Do not use a ParcelableBundle for notifyNetworkTested or
   notifyDataStallSuspected; instead use AIDL parcelables for stronger
   backwards compatibility guarantees.

Test: atest NetworkMonitorTest ConnectivityServiceTest
      ConnectivityServiceIntegrationTest, manual
Bug: 153500847
Merged-In: Id9b71784e5f6294d203230e57737979e063ff0f8
Change-Id: Id9b71784e5f6294d203230e57737979e063ff0f8
2020-04-28 08:09:17 +00:00
Cody Kesting
fc7cad313d Set owner and administrator UIDs for test networks.
This change sets the owner and administrator UIDs for test networks when
their initial values match the UID for the app creating the test
network. This ensures that apps registering test networks can only make
themselves owners / administrators of the network.

Bug: 153449964
Test: atest NetworkAgentTest
Change-Id: I3a974700aa1d83cb285295ed1de0aa263e2e5b58
2020-04-27 20:54:57 -07:00
Benedict Wong
9c42a8e601 Merge "Add tests for Tunnel, Transport mode application with released SPIs" am: 27a2f1dff8 am: aed6b6ff17
Change-Id: I91a4f355cd2a397a9f24c0d5f5381a51523a1fe0
2020-04-24 23:27:48 +00:00
Benedict Wong
25dec3b6e5 Merge "Use TransformRecord to get SPI instead of SpiRecord" am: 88c8a19311 am: fc7ba96b15
Change-Id: Ibc3090627699aecb4ab5e183219b5848005d0412
2020-04-24 23:27:36 +00:00
Benedict Wong
27a2f1dff8 Merge "Add tests for Tunnel, Transport mode application with released SPIs" 2020-04-24 22:32:41 +00:00
Benedict Wong
88c8a19311 Merge "Use TransformRecord to get SPI instead of SpiRecord" 2020-04-24 22:32:41 +00:00
Remi NGUYEN VAN
6819fe0fc9 Merge "Address comments on NetworkStack AIDL v6" am: 0e93810453 am: e468a26c7a
Change-Id: Id385210ccd8d08bc2d15e964bbca25c452a3cde8
2020-04-24 12:19:37 +00:00
Remi NGUYEN VAN
0e93810453 Merge "Address comments on NetworkStack AIDL v6" 2020-04-24 11:56:32 +00:00
Remi NGUYEN VAN
9b647ca69a Address comments on NetworkStack AIDL v6
Address issues found during AIDL review:
 - Rename clientAddr to singleClientAddr
 - Do not use a ParcelableBundle for notifyNetworkTested or
   notifyDataStallSuspected; instead use AIDL parcelables for stronger
   backwards compatibility guarantees.

Test: atest NetworkMonitorTest ConnectivityServiceTest
      ConnectivityServiceIntegrationTest, manual
Bug: 153500847
Change-Id: Id9b71784e5f6294d203230e57737979e063ff0f8
2020-04-24 18:52:02 +09:00
Philip P. Moltmann
84091e184a Merge "Set attributionTag for noteOp(WRITE_SETTINGS) calls" am: da8697a48b am: 7b3866f284
Change-Id: I099944752fc3006c1e98750dd46dbebf5e50789f
2020-04-22 15:19:14 +00:00
Philip P. Moltmann
7bc33dfb89 Set attributionTag for noteOp(WRITE_SETTINGS) calls
Test: atest FrameworksNetTests TetheringTests:TetheringServiceTest
Bug: 136595429
Merged-In: I33f787644c44d7b0e5ce17a433820cfcd985cdfb
Change-Id: Ic3d937e7bb5141798234ed5b2852c1f768e97495
2020-04-20 18:00:03 -07:00
Lorenzo Colitti
c9016cafe3 Stop prefix discovery if an RA prefix arrives in DISCOVERING
Currently, if a prefix is learned from an RA while prefix
discovery is running, clatd will be correctly started, but
prefix discovery will be stopped.

In order to fix this, make it possible to call
stopPrefixDiscovery without transitioning to IDLE state (which
is obviously necessary in this case), by moving the assignment of
the next state from that method to its callers. For consistency,
do the same for startPrefixDiscovery.

Bug: 150648313
Test: new test coverage
Change-Id: I3803fa3d9806848b331c35ee8bac256934bd1f21
Merged-In: I3803fa3d9806848b331c35ee8bac256934bd1f21
(cherry picked from commit c7c6f76402a989f91b02c37574b6a9de592cf1af)
2020-04-20 12:06:45 +00:00
Lorenzo Colitti
1c0d43fc15 Make the Nat464Xlat tests more realistic.
464xlat will never be started on a network that is not connected,
or on a network that has no IPv6 address.

This is a no-op test-only change but it is necessary for an
upcoming change that violates some of the invalid assumptions
currently made by this test and causes it to fail.

Bug: 150648313
Test: test-only change
Change-Id: I41766e9adaa7c24454648b371e6e3cc647693be5
Merged-In: I41766e9adaa7c24454648b371e6e3cc647693be5
(cherry picked from commit df0c522d18ee73c1d20cff1a1dc955b383e6c355)
2020-04-20 12:05:36 +00:00
Lorenzo Colitti
4308bfc4f0 Support learning the NAT64 prefix from two different sources.
The NAT64 prefix from the RA always takes precedence over the
NAT64 prefix from DNS discovery, because it is detected faster,
and detecting it does not require sending any packets.

Bug: 150648313
Test: new unit test
Merged-In: Ic7452431d2d9aea1ae59b67a9d8383c6cc5b3902
Change-Id: Ic7452431d2d9aea1ae59b67a9d8383c6cc5b3902
2020-04-20 11:53:00 +00:00
Lorenzo Colitti
6bb660e9f4 Merge "Stop prefix discovery if an RA prefix arrives in DISCOVERING" am: c44ca579ad am: d0359ea573
Change-Id: If6dd56d2860611586af3c434af3ddc4b6df76ab3
2020-04-20 11:38:11 +00:00
Lorenzo Colitti
9a8f4c8067 Merge "Make the Nat464Xlat tests more realistic." am: 6ce7a2aeee am: 3da6384b41
Change-Id: Ib8d91c81af3d2e5d03c0fd47f415ff93fee5e2aa
2020-04-20 11:37:54 +00:00
Lorenzo Colitti
27bb67c35b Merge "Support learning the NAT64 prefix from two different sources." am: 204b31920f am: a00f03dd61
Change-Id: I0c7e48c0b16fe09269ced98712bd636105f46a5c
2020-04-20 11:37:18 +00:00
Lorenzo Colitti
38c6519a90 Stop prefix discovery if an RA prefix arrives in DISCOVERING
Currently, if a prefix is learned from an RA while prefix
discovery is running, clatd will be correctly started, but
prefix discovery will be stopped.

In order to fix this, make it possible to call
stopPrefixDiscovery without transitioning to IDLE state (which
is obviously necessary in this case), by moving the assignment of
the next state from that method to its callers. For consistency,
do the same for startPrefixDiscovery.

Bug: 150648313
Test: new test coverage
Change-Id: I3803fa3d9806848b331c35ee8bac256934bd1f21
2020-04-20 17:54:20 +09:00
Lorenzo Colitti
c6bd5847c9 Make the Nat464Xlat tests more realistic.
464xlat will never be started on a network that is not connected,
or on a network that has no IPv6 address.

This is a no-op test-only change but it is necessary for an
upcoming change that violates some of the invalid assumptions
currently made by this test and causes it to fail.

Bug: 150648313
Test: test-only change
Change-Id: I41766e9adaa7c24454648b371e6e3cc647693be5
2020-04-20 17:54:20 +09:00
Lorenzo Colitti
e2eade021a Support learning the NAT64 prefix from two different sources.
The NAT64 prefix from the RA always takes precedence over the
NAT64 prefix from DNS discovery, because it is detected faster,
and detecting it does not require sending any packets.

Bug: 150648313
Test: new unit test
Change-Id: Ic7452431d2d9aea1ae59b67a9d8383c6cc5b3902
2020-04-20 16:50:53 +09:00
Bruce Chen
60afb5ab62 Merge "Add testTransportTypesEqual to dnsmanager test cases" into rvc-dev 2020-04-17 08:25:23 +00:00
Bruce Chen
4e54d05cbc Add testTransportTypesEqual to dnsmanager test cases
A test that ensures that NetworkCapabilities.TRANSPORT_* is eaual
to IDnsResolver.TRANSPORT_* for every possible value of each.

Bug: 153267602
Test: atest FrameworksNetTests
Merged-In: I6b23ccc6ce1659fdfd9573dfcd895f2c20fa9417
Change-Id: I3dd4ed0d1fcceca9c8aec9b3e6769603e4fa913b
(cherry picked from commit 5f28e6f881e0ea52e8e96c1207654ce44b0d05a1)
2020-04-17 05:25:31 +00:00
Lorenzo Colitti
aa0c7d00cf Support changing the NAT64 prefix without removing it.
This cannot (currently) happen with DNS64 detection, but it can
happen with the PREF64 option.

Bug: 150648313
Test: atest ConnectivityServiceTest Nat464XlatTest --rerun-until-failure 100
Merged-In: I789fe9d46d3ac5d074ae697d23013f24a9e0246d
Change-Id: I789fe9d46d3ac5d074ae697d23013f24a9e0246d
2020-04-17 04:37:26 +00:00
Bruce Chen
2bbce4526c Merge "Add testTransportTypesEqual to dnsmanager test cases" am: 0e97073a4d am: fe5c71b37f
Change-Id: I0ccca97191773aa77d1c85481d73e0adaf1d0b7a
2020-04-17 03:38:52 +00:00
Bruce Chen
0e97073a4d Merge "Add testTransportTypesEqual to dnsmanager test cases" 2020-04-17 02:59:15 +00:00
Junyu Lai
9151f7c748 Merge "[SP27.3] Rename TestableNetworkStatsProvider" 2020-04-17 02:24:55 +00:00
Lorenzo Colitti
32dc5cae3c Merge "Support changing the NAT64 prefix without removing it." am: f09bc1734f am: 3813daab0b
Change-Id: I19050527eb41a58c7844972f34e92719d2344c27
2020-04-16 16:49:33 +00:00
Lorenzo Colitti
f09bc1734f Merge "Support changing the NAT64 prefix without removing it." 2020-04-16 16:24:57 +00:00
chenbruce
01950be123 Add testTransportTypesEqual to dnsmanager test cases
A test that ensures that NetworkCapabilities.TRANSPORT_* is eaual
to IDnsResolver.TRANSPORT_* for every possible value of each.

Bug: 153267602
Test: atest FrameworksNetTests
Change-Id: I6b23ccc6ce1659fdfd9573dfcd895f2c20fa9417
2020-04-16 18:04:16 +08:00
Lorenzo Colitti
7f3d684631 Support changing the NAT64 prefix without removing it.
This cannot (currently) happen with DNS64 detection, but it can
happen with the PREF64 option.

Bug: 150648313
Test: atest ConnectivityServiceTest Nat464XlatTest --rerun-until-failure 100
Change-Id: I789fe9d46d3ac5d074ae697d23013f24a9e0246d
2020-04-16 00:07:30 +09:00
Junyu Lai
dd44555083 Merge "[SM10] Adopt helper class to monitor RAT type change per sub" into rvc-dev 2020-04-15 11:49:01 +00:00
junyulai
d8d7916d95 [SP27.3] Rename TestableNetworkStatsProvider
Currently, TestableNetworkStatsProvider is a subclass of
INetworkStatsProvider. This is not very accurate naming after
API council review feedback since now we have
NetworkStatsProvider as a system api interface.

This is the counter-part change of actual renaming CL in
NetworkStack.

Test: atest FrameworksNetTests TetheringTests
Bug: 150643374
Change-Id: Ifa8175dc4e2fe2b907ec13b3bd2eca12974f5ea7
Merged-In: Ifa8175dc4e2fe2b907ec13b3bd2eca12974f5ea7
(cherry-picked from ag/10976522)
2020-04-15 19:01:13 +08:00
Junyu Lai
3db3e009be Merge "[SP27.3] Rename TestableNetworkStatsProvider" into rvc-dev 2020-04-15 10:44:23 +00:00
junyulai
c6081f9c50 [SM10] Adopt helper class to monitor RAT type change per sub
Test: atest NetworkStatsServiceTest
Bug: 146415925
Change-Id: I45c3aa9046b316c8cd0943543d620a22e4afefd1
Merged-In: I45c3aa9046b316c8cd0943543d620a22e4afefd1
(cherry picked from commit 219faff07bdc58c14fe58fc525e86383db1f8167)
2020-04-15 10:30:49 +00:00
Lorenzo Colitti
d275ec139a Merge "Set transport types to resolver" 2020-04-13 07:03:20 +00:00
chenbruce
7b2f898a9a Set transport types to resolver
For a given network, resolver doesn't know what transport types are.
Therefore, when a new network is created or transport types are changed
in a give network, transport types will be updated and sent by calling
setResolverConfiguration(). In the same time, if link properties or
transport types are null, setResolverConfiguration() won't be called.
The original behaviors of setResolverConfiguration() aren't changed.
Only increasing one new behavior that when a given network has transport
type change, calling setResolverConfiguration() directly and resolver
updates the transport types for that given network.

Bug: 143732914
Test: atest FrameworksNetTests
      atest FrameworksNetIntegrationTests
Merged-In: I03fc5c62dfd9a51a78a720860531df282fdecc20
Change-Id: I6527cde0e177ba08c886576131b35fc769c2bb53
2020-04-11 23:00:13 +08:00
chenbruce
db2aad69ed Set transport types to resolver
For a given network, resolver doesn't know what transport types are.
Therefore, when a new network is created or transport types are changed
in a give network, transport types will be updated and sent by calling
setResolverConfiguration(). In the same time, if link properties or
transport types are null, setResolverConfiguration() won't be called.
The original behaviors of setResolverConfiguration() aren't changed.
Only increasing one new behavior that when a given network has transport
type change, calling setResolverConfiguration() directly and resolver
updates the transport types for that given network.

Bug: 143732914
Test: atest FrameworksNetTests
      atest FrameworksNetIntegrationTests
Change-Id: I6527cde0e177ba08c886576131b35fc769c2bb53
2020-04-11 14:39:59 +08:00
junyulai
09d50fe69d [SP27.3] Rename TestableNetworkStatsProvider
Currently, TestableNetworkStatsProvider is a subclass of
INetworkStatsProvider. This is not very accurate naming after
API council review feedback since now we have
NetworkStatsProvider as a system api interface.

This is the counter-part change of actual renaming CL in
NetworkStack.

Test: atest FrameworksNetTests TetheringTests
Bug: 150643374
Change-Id: Ifa8175dc4e2fe2b907ec13b3bd2eca12974f5ea7
2020-04-08 17:36:45 +08:00
Hall Liu
a85ea98c7a Add gating, logging for PhoneStateListener's limit
Add gating via PlatformCompat and DeviceConfig and logging via
PlatformCompat to the limit instituted on per-process listeners

Fixes: 152074216
Test: atest CtsTelephonyHostCases
Change-Id: I4d6681d90705b68c3349f4124e434a29b50fd3a2
Merged-In: I4d6681d90705b68c3349f4124e434a29b50fd3a2
2020-04-07 17:13:19 -07:00
Lorenzo Colitti
6c0cbccf96 Rename the *Nat64Prefix to *Nat64PrefixFromDns.
This just a rename with no functional changes at all. It is
preparation for supporting getting the NAT64 prefix from the
RA.

Bug: 150648313
Test: covered by existing ConnectivityServiceTest and Nat464XlatTest
Merged-In: Ia9a09a708870827b1e4cf068f930fa9542dd116c
Change-Id: Ia9a09a708870827b1e4cf068f930fa9542dd116c
2020-04-06 15:45:14 +00:00
Lorenzo Colitti
d523d1416d Rename the *Nat64Prefix to *Nat64PrefixFromDns.
This just a rename with no functional changes at all. It is
preparation for supporting getting the NAT64 prefix from the
RA.

Bug: 150648313
Test: covered by existing ConnectivityServiceTest and Nat464XlatTest
Change-Id: Ia9a09a708870827b1e4cf068f930fa9542dd116c
2020-04-02 22:48:03 +09:00
Lorenzo Colitti
7fb7c3e0bf Only apply VPN isolation if it's fully routed
VPN is considered fully routed if both IPv4 and IPv6 have
either a default route or a prohibit route.

Bug: 145332510
Test: atest FrameworksNetTests
Merged-In: I59cf48552bca98092d1212e3d718fd420add5458
Change-Id: I59cf48552bca98092d1212e3d718fd420add5458
2020-04-02 10:36:19 +00:00