Commit Graph

1649 Commits

Author SHA1 Message Date
TreeHugger Robot
5d8ff46bda Merge "Update DnsManagerTest for AIDL interface change" into rvc-dev am: ee9ca628ca am: e585912db3 am: 84f2eb10e7 am: 9260b81d86
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11954238

Change-Id: I21129279b6ac94bebb55e0798e0da12ef5a0b5eb
2020-06-22 16:00:44 +00:00
TreeHugger Robot
e585912db3 Merge "Update DnsManagerTest for AIDL interface change" into rvc-dev am: ee9ca628ca
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11954238

Change-Id: I1327794e6b8201d3c47c39838cfa516812cf273d
2020-06-22 15:18:45 +00:00
TreeHugger Robot
ee9ca628ca Merge "Update DnsManagerTest for AIDL interface change" into rvc-dev 2020-06-22 15:09:54 +00:00
Ken Chen
125db20ee5 Update DnsManagerTest for AIDL interface change
Check one more parameter enforceDnsUid in ResolverOptionsParcel in
DnsManagerTest.

Bug: 159587277
Test: atest
com.android.server.connectivity.DnsManagerTest#testSendDnsConfiguration

Change-Id: Ic53f42b968626294c851dac252a70769846ba427
2020-06-22 21:44:07 +08:00
Mike Yu
1a5e45e37d Support DNS-over-TLS probes in NetworkDiagnostics
Probe DNS servers to see they support DNS-over-TLS. Use system
CAs to verify whether the certificates sent by DNS servers are
trusted or not. An error is thrown to cause the probe failed if
DNS servers send untrusted certificates.

Unlike the DnsResolver which doesn't verify the certificates
in opportunistic mode, all of the DoT probes from NetworkDiagnostics
check certificates.

DoT probes apply to the DNS servers gotten from LinkProperties
and the DoT servers gotten from PrivateDnsConfig whatever private
DNS mode is.

A common example in DNS strict mode:
.  DNS TLS dst{8.8.8.8} hostname{dns.google} src{192.168.43.2:48436} qtype{1} qname{815149-android-ds.metric.gstatic.com}: SUCCEEDED: 1/1 NOERROR (432ms)
F  DNS TLS dst{192.168.43.144} hostname{}: FAILED: java.net.ConnectException: failed to connect to /192.168.43.144 (port 853) from /192.168.43.2 (port 41770) after 2500ms: isConnected failed: ECONNREFUSED (Connection refused) (172ms)
.  DNS TLS dst{8.8.4.4} hostname{dns.google} src{192.168.43.2:37598} qtype{1} qname{759312-android-ds.metric.gstatic.com}: SUCCEEDED: 1/1 NOERROR (427ms)

An example when the CA is not trusted:
F  DNS TLS dst{8.8.8.8} hostname{dns.google}: FAILED: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. (16ms)

An example when TCP/TLS handshake timeout:
F  DNS TLS dst{8.8.8.8} hostname{dns.google}: FAILED: java.net.SocketTimeoutException: failed to connect to /8.8.8.8 (port 853) from /192.168.2.108 (port 45680) after 2500ms (2514ms)

Bug: 132925257
Bug: 118369977
Test: atest FrameworksNetTests
Original-Change: https://android-review.googlesource.com/1011670
Merged-In: I1b54abed0e931ca4b8a97149459cde54da1c3d6f
Change-Id: I1b54abed0e931ca4b8a97149459cde54da1c3d6f
2020-06-22 08:57:49 +00:00
Mike Yu
92fa8805da Merge "Support DNS-over-TLS probes in NetworkDiagnostics" am: 64ffa1762f am: 00a89d0481 am: 075dccdc96 am: aa4a2e335f am: 7491639dd4
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1011670

Change-Id: Ica4a8e861c60ba00d7ff80f4a6564ac411a12f8b
2020-06-22 07:33:11 +00:00
Mike Yu
075dccdc96 Merge "Support DNS-over-TLS probes in NetworkDiagnostics" am: 64ffa1762f am: 00a89d0481
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1011670

Change-Id: I25a06623d87e6971a9dac73bdea82a78fd6124d6
2020-06-22 06:56:39 +00:00
Mike Yu
6a49d466d2 Support DNS-over-TLS probes in NetworkDiagnostics
Probe DNS servers to see they support DNS-over-TLS. Use system
CAs to verify whether the certificates sent by DNS servers are
trusted or not. An error is thrown to cause the probe failed if
DNS servers send untrusted certificates.

Unlike the DnsResolver which doesn't verify the certificates
in opportunistic mode, all of the DoT probes from NetworkDiagnostics
check certificates.

DoT probes apply to the DNS servers gotten from LinkProperties
and the DoT servers gotten from PrivateDnsConfig whatever private
DNS mode is.

A common example in DNS strict mode:
.  DNS TLS dst{8.8.8.8} hostname{dns.google} src{192.168.43.2:48436} qtype{1} qname{815149-android-ds.metric.gstatic.com}: SUCCEEDED: 1/1 NOERROR (432ms)
F  DNS TLS dst{192.168.43.144} hostname{}: FAILED: java.net.ConnectException: failed to connect to /192.168.43.144 (port 853) from /192.168.43.2 (port 41770) after 2500ms: isConnected failed: ECONNREFUSED (Connection refused) (172ms)
.  DNS TLS dst{8.8.4.4} hostname{dns.google} src{192.168.43.2:37598} qtype{1} qname{759312-android-ds.metric.gstatic.com}: SUCCEEDED: 1/1 NOERROR (427ms)

An example when the CA is not trusted:
F  DNS TLS dst{8.8.8.8} hostname{dns.google}: FAILED: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. (16ms)

An example when TCP/TLS handshake timeout:
F  DNS TLS dst{8.8.8.8} hostname{dns.google}: FAILED: java.net.SocketTimeoutException: failed to connect to /8.8.8.8 (port 853) from /192.168.2.108 (port 45680) after 2500ms (2514ms)

Bug: 132925257
Bug: 118369977
Test: atest FrameworksNetTests
Change-Id: I1b54abed0e931ca4b8a97149459cde54da1c3d6f
2020-06-20 16:22:35 +08:00
Aaron Huang
f31016223a Merge "Address comments from aosp/1298476" am: 777fbbb954 am: eb276cb5b3 am: a12b3d3626 am: b9e62de14f am: 6424968d64
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1340040

Change-Id: I29d735d0edb861fc154568aaf0e63a4ae2f9b441
2020-06-18 11:25:23 +00:00
Aaron Huang
a12b3d3626 Merge "Address comments from aosp/1298476" am: 777fbbb954 am: eb276cb5b3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1340040

Change-Id: I7b119758ac7cd65defdec77692957287af17566d
2020-06-18 10:47:47 +00:00
Aaron Huang
798627b03d Address comments from aosp/1298476
This patch addresses the followings,
- Pass Looper to NetworkStatsSubscriptionsMonitor constructor
- Replace Looper with TestLooper in unit test
- Assert fail if result of condition check is not expected.

Bug: 154080205
Test: atest FrameworksNetTests:com.android.server.net.NetworkStatsServiceTest
      atest FrameworksNetTests:com.android.server.net.NetworkStatsSubscriptionsMonitorTest
Change-Id: Ibcaba2b38af80cc0ec9a4e428a3b3a1538bc4325
2020-06-18 15:05:19 +08:00
Aaron Huang
43dbab1c7a Merge "Dynamically enable/disable watch for RAT type changes" am: 26d523e981 am: abc4648d47 am: a451367f7e am: 7dc8148970 am: a521f5b392
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1315574

Change-Id: I0e19a6f752579b82682f5d8cfa3589657e23fd1f
2020-06-18 04:51:54 +00:00
Aaron Huang
a451367f7e Merge "Dynamically enable/disable watch for RAT type changes" am: 26d523e981 am: abc4648d47
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1315574

Change-Id: I5a96774ad2104a6b03c9abab2b105b97195edea8
2020-06-18 04:22:21 +00:00
Aaron Huang
26d523e981 Merge "Dynamically enable/disable watch for RAT type changes" 2020-06-18 03:51:51 +00:00
Aaron Huang
ad9a0e7713 Merge "Add unit test for NetworkStatsSubscriptionsMonitor" 2020-06-17 08:52:20 +00:00
Aaron Huang
3a2e972406 Dynamically enable/disable watch for RAT type changes
Add ContentObserver to observe the status of
NETSTATS_COMBINE_SUBTYPE_ENABLED to determine that
NetworkStatsSubscriptionsMonitor start or stop
monitoring data usage per RAT type changes.

Bug: 154080515
Test: atest NetworkStatsServiceTest#testDynamicWatchForNetworkRatTypeChanges
Change-Id: I272d589633c9186b45753228b05aa0b40b7c7b89
2020-06-17 17:09:10 +09:00
Chiachang Wang
4d2791b1a6 Test extra info sent to NetworkMonitor
Test extra info sent to NetworkMonitor correctly if network
agent is created through new NetworkAgent constructor without
legacy network info taken as parameter.

Bug: 156173829
Test: atest FrameworkNetTests
Merged-In: I4f827664c528bea30cc957a0a617dd37693f4460
Change-Id: I4f827664c528bea30cc957a0a617dd37693f4460
2020-06-16 01:57:46 +00:00
Chiachang Wang
cb97236bcb Merge "Test extra info sent to NetworkMonitor" am: 4f45ccd46b am: dbcfe36229 am: 43b8b17a1e am: 0f59df5b76 am: 98d80dbf0d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1331060

Change-Id: Idef226312b728fb041d9f58e664d8a9a2cad7f9f
2020-06-16 01:44:23 +00:00
Chiachang Wang
43b8b17a1e Merge "Test extra info sent to NetworkMonitor" am: 4f45ccd46b am: dbcfe36229
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1331060

Change-Id: Ice048df853589411ee1f1c935b929994af1c525b
2020-06-16 01:02:52 +00:00
Aaron Huang
92b5c72c5b Add unit test for NetworkStatsSubscriptionsMonitor
Bug: 154080205
Test: atest FrameworksNetTests:com.android.server.net.NetworkStatsSubscriptionsMonitorTest
(copy from ag/11788484 but getActiveAndHiddenSubscriptionIdList() since it's renamed
in internal)
Change-Id: Ia162f36efe96d90b2f6f70190d9fa855bba34484
Merged-In: I4ef3f1ab2e5ea1322133edd80db3ccd0022e9c91
2020-06-15 07:05:19 +00:00
Chiachang Wang
2153861f8e Test extra info sent to NetworkMonitor
Test extra info sent to NetworkMonitor correctly if network
agent is created through new NetworkAgent constructor without
legacy network info taken as parameter.

Bug: 156173829
Test: atest FrameworkNetTests
Change-Id: I4f827664c528bea30cc957a0a617dd37693f4460
2020-06-12 18:13:00 +08:00
Aaron Huang
2f4f5ceb1e Merge "Add unit test for NetworkStatsSubscriptionsMonitor" into rvc-dev am: 32f8a56636 am: 7a65307e4f am: 2acbd72f5e am: c9048cf1dd
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11788484

Change-Id: I8a039b0c164e51ed9054d229f52ece259b894b63
2020-06-12 02:35:26 +00:00
Aaron Huang
c9048cf1dd Merge "Add unit test for NetworkStatsSubscriptionsMonitor" into rvc-dev am: 32f8a56636 am: 7a65307e4f am: 2acbd72f5e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11788484

Change-Id: I643f27dda377ee5d2fa885cac8b814445363a20d
2020-06-12 02:31:29 +00:00
Aaron Huang
ea43b62474 Merge "Add unit test for NetworkStatsSubscriptionsMonitor" into rvc-dev am: 32f8a56636
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11788484

Change-Id: Iac633487b359d751206e06b2352a2a9cb475811e
2020-06-12 02:11:29 +00:00
Aaron Huang
e4e86e1cad Add unit test for NetworkStatsSubscriptionsMonitor
Bug: 154080205
Test: atest FrameworksNetTests:com.android.server.net.NetworkStatsSubscriptionsMonitorTest
Change-Id: I4ef3f1ab2e5ea1322133edd80db3ccd0022e9c91
2020-06-09 00:40:36 +08:00
Benedict Wong
818fff98c9 Merge "Add RequiresFeature annotations for IKEv2 VPN profiles" into rvc-dev am: c5401ef015 am: b7e4fc0606 am: 4665054ee2 am: 011e7a7dd3
Change-Id: I3f95200a5bdcec9b6e0f6b6e0dddfa218240cd48
2020-05-29 18:23:15 +00:00
Benedict Wong
4665054ee2 Merge "Add RequiresFeature annotations for IKEv2 VPN profiles" into rvc-dev am: c5401ef015 am: b7e4fc0606
Change-Id: Id03dc7e3e2912f308b4ed42f2cc8cae80d9cd95d
2020-05-29 17:45:55 +00:00
Benedict Wong
5b05c2ff71 Merge "Add RequiresFeature annotations for IKEv2 VPN profiles" into rvc-dev am: c5401ef015
Change-Id: Ibc0f236234cd87d50a393c3dfaca7898b04e7432
2020-05-29 17:32:42 +00:00
Benedict Wong
29d6412115 Add RequiresFeature annotations for IKEv2 VPN profiles
This change adds the @RequiresFeature annotation to Ikev2VpnProfile
Builder methods, and checks before provisioning VPN profiles.

Bug: 156681625
Test: New tests added, passing.
Change-Id: I125d8fbe5d67fb877ad7d0636c007cb3e1a9f59b
Merged-In: I125d8fbe5d67fb877ad7d0636c007cb3e1a9f59b
(cherry picked from commit e84a17dd17)
2020-05-28 19:07:29 -07:00
Benedict Wong
9d7577537b Merge "Add RequiresFeature annotations for IKEv2 VPN profiles" 2020-05-29 01:55:08 +00:00
Maciej Żenczykowski
e0131e56ae Merge changes Ie73ba058,I4393afcb,Ifebd946e,Ib12ee882,Ia171b779 am: e273042404 am: e0f1768048 am: 42f451c579 am: b26855f1bb am: 44ceb47bd4
Change-Id: I067445d4b712184da693a9cb15c0309fd9f2ff0d
2020-05-28 10:30:55 +00:00
Maciej Żenczykowski
e07aa4a466 fix com.android.server.net.NetworkStatsFactoryTest#testDoubleClatAccounting100MBDownload
No clat app uid 0 rx stats on base iface due to ip6tables raw prerouting drop

(so just copy over the rx stats from the before file)

Test: atest NetworkStatsTest NetworkStatsFactoryTest
Bug: 150738490
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie73ba0586dafde67bc2726db26e07f7268c18be3
Merged-In: Ie73ba0586dafde67bc2726db26e07f7268c18be3
2020-05-28 02:44:02 -07:00
Maciej Żenczykowski
c9e6605320 fix com.android.server.net.NetworkStatsFactoryTest#testDoubleClatAccounting
No clat app uid 0 rx stats on base iface due to ip6tables raw prerouting drop

Test: atest NetworkStatsFactoryTest
Bug: 150738490
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I4393afcbe8e1bb886ecf4f5c1573f6ac8a0e29f5
Merged-In: I4393afcbe8e1bb886ecf4f5c1573f6ac8a0e29f5
2020-05-28 02:43:53 -07:00
Maciej Żenczykowski
42f451c579 Merge changes Ie73ba058,I4393afcb,Ifebd946e,Ib12ee882,Ia171b779 am: e273042404 am: e0f1768048
Change-Id: If8abb4247759462532cbac6b43bfb8d3202c6e34
2020-05-28 09:36:05 +00:00
Maciej Żenczykowski
c1aeb69e59 fix com.android.server.net.NetworkStatsFactoryTest#testDoubleClatAccounting100MBDownload
No clat app uid 0 rx stats on base iface due to ip6tables raw prerouting drop

(so just copy over the rx stats from the before file)

Test: atest NetworkStatsTest NetworkStatsFactoryTest
Bug: 150738490
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie73ba0586dafde67bc2726db26e07f7268c18be3
2020-05-28 00:26:18 -07:00
Maciej Żenczykowski
3f9933c48d fix com.android.server.net.NetworkStatsFactoryTest#testDoubleClatAccounting
No clat app uid 0 rx stats on base iface due to ip6tables raw prerouting drop

Test: atest NetworkStatsFactoryTest
Bug: 150738490
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I4393afcbe8e1bb886ecf4f5c1573f6ac8a0e29f5
2020-05-28 00:26:18 -07:00
Benedict Wong
8f29769362 Merge "Add methods for IKEv2/IPsec test mode profiles" into rvc-dev 2020-05-27 17:31:00 +00:00
Benedict Wong
e84a17dd17 Add RequiresFeature annotations for IKEv2 VPN profiles
This change adds the @RequiresFeature annotation to Ikev2VpnProfile
Builder methods, and checks before provisioning VPN profiles.

Bug: 156681625
Test: New tests added, passing.
Change-Id: I125d8fbe5d67fb877ad7d0636c007cb3e1a9f59b
2020-05-27 02:05:49 -07:00
Lorenzo Colitti
7f7171c6a1 Inform the DNS resolver when it needs to do DNS64 synthesis.
This is only necessary when learning the NAT64 prefix from the
RA, because if the NAT64 prefix is learned from DNS, the DNS
resolver already knows the prefix and automatically enables
DNS64 synthesis.

The DNS resolver needs to be informed of the prefix any time
clat is running on a prefix learned from an RA. This is simple to
implement: just set the prefix when starting clat if prefix
discovery is not running, and clear the prefix when stopping clat
if prefix discovery was not running. This ensures that the prefix
is cleared iff it was set.

Bug: 156914456
Test: new unit test coverage
Original-Change: https://android-review.googlesource.com/1315578
Merged-In: If8ad2d30712a6df3e207c8d3e8a129705242191e
Change-Id: If8ad2d30712a6df3e207c8d3e8a129705242191e
2020-05-26 11:52:35 +00:00
Lorenzo Colitti
fbf205a380 Test that if an RA sets the same prefix as DNS, nothing happens.
This is not particularly likely to happen unless the pref64 RA is
sent by a different router than the main RA. But more tests are
always good, and this additional coverage will be more useful
in an upcoming change.

Bug: 150648313
Test: test-only change
Original-Change: https://android-review.googlesource.com/1316094
Merged-In: I3316d49d42100800740afadc4edf0a13a4d8377c
Change-Id: I3316d49d42100800740afadc4edf0a13a4d8377c
2020-05-26 11:35:33 +00:00
Lorenzo Colitti
13decc194b Merge "Inform the DNS resolver when it needs to do DNS64 synthesis." am: 808cb66c50 am: eae6b8a201 am: 8c0378e7e8 am: 7d669cded7 am: 66176cd9c5
Change-Id: I6bb6f038af9988502f15894349039fec51dc8a86
2020-05-26 10:59:30 +00:00
Lorenzo Colitti
8c0378e7e8 Merge "Inform the DNS resolver when it needs to do DNS64 synthesis." am: 808cb66c50 am: eae6b8a201
Change-Id: I06278ddff31d8c0dbb4ce6cfded01a38369d8a3c
2020-05-26 10:13:17 +00:00
Lorenzo Colitti
808cb66c50 Merge "Inform the DNS resolver when it needs to do DNS64 synthesis." 2020-05-26 09:26:46 +00:00
Lorenzo Colitti
abe31686e8 Merge "Test that if an RA sets the same prefix as DNS, nothing happens." am: 68a9de91fe am: 59d8d9afbb am: 0525f31d6b am: 1f3d6ceef8 am: bc6e27895f
Change-Id: I58fbdf5bf51a1048acf61bd25107e2f2caa86617
2020-05-24 12:14:57 +00:00
Lorenzo Colitti
0525f31d6b Merge "Test that if an RA sets the same prefix as DNS, nothing happens." am: 68a9de91fe am: 59d8d9afbb
Change-Id: Ib2eb07e3794630cc636759ce6a6529b7b56a3cfe
2020-05-24 11:30:55 +00:00
Lorenzo Colitti
68a9de91fe Merge "Test that if an RA sets the same prefix as DNS, nothing happens." 2020-05-24 10:59:40 +00:00
Lorenzo Colitti
82bb897e87 Inform the DNS resolver when it needs to do DNS64 synthesis.
This is only necessary when learning the NAT64 prefix from the
RA, because if the NAT64 prefix is learned from DNS, the DNS
resolver already knows the prefix and automatically enables
DNS64 synthesis.

The DNS resolver needs to be informed of the prefix any time
clat is running on a prefix learned from an RA. This is simple to
implement: just set the prefix when starting clat if prefix
discovery is not running, and clear the prefix when stopping clat
if prefix discovery was not running. This ensures that the prefix
is cleared iff it was set.

Bug: 156914456
Test: new unit test coverage
Change-Id: If8ad2d30712a6df3e207c8d3e8a129705242191e
2020-05-21 23:32:57 +09:00
Treehugger Robot
54b0fb1323 Merge "Suppress deprecation warnings in LegacyTypeTrackerTest." am: 6e830b854e am: 5b3e7d90d0 am: 1233f72fab am: 192074f36e am: de1c84a371
Change-Id: Ia7a29777227d1780e620c6c6b0ad84925512be12
2020-05-21 09:17:22 +00:00
Treehugger Robot
1233f72fab Merge "Suppress deprecation warnings in LegacyTypeTrackerTest." am: 6e830b854e am: 5b3e7d90d0
Change-Id: I77fdf03484bd0da36ebffd025a33ab4859a0a5a2
2020-05-21 08:31:13 +00:00
Lorenzo Colitti
4afb82b32e Test that if an RA sets the same prefix as DNS, nothing happens.
This is not particularly likely to happen unless the pref64 RA is
sent by a different router than the main RA. But more tests are
always good, and this additional coverage will be more useful
in an upcoming change.

Bug: 150648313
Test: test-only change
Change-Id: I3316d49d42100800740afadc4edf0a13a4d8377c
2020-05-21 17:26:00 +09:00