Commit Graph

8618 Commits

Author SHA1 Message Date
Pavel Grafov
22fbf24ce4 Merge "Connectivity: start PAC global proxy after reboot." 2020-07-03 10:54:10 +00:00
Chalard Jean
064d18d188 Revert "Move Inet[4]AddressUtils to libs/net"
This reverts commit c98e38195d.

Reason for revert: Breaks the build b/160390899

Merged-In: Icd141a992c46290c74929785e261a1cd57bc001b
Change-Id: Ie10e66f61393602f17fbb61bf17230b176bf1f44
2020-07-02 23:47:35 +00:00
Remi NGUYEN VAN
c98e38195d Move Inet[4]AddressUtils to libs/net
The classes should not be picked up from frameworks/base, as they are
part of several mainline modules.

Also refine comments in DhcpResults following feedback in previous
change.

(cherry-pick from internal branch skipping wifi classes; no other
conflict)

Bug: 151052811
Test: m; manual: flashed, wifi and telephony working
Test: atest NetworkStackCoverageTests
Merged-In: I7074651c6a2a7a6b11bcf13cc4bb03833d7d655f

Change-Id: I7074651c6a2a7a6b11bcf13cc4bb03833d7d655f
2020-07-02 10:52:31 +09:00
Chalard Jean
8ec089e59a Merge "Revert "Test IPv6ProvisioningLossParcelable in the NetworkAttrib..."" 2020-07-01 05:12:40 +00:00
Chalard Jean
f90e5bcc2a Revert "Test IPv6ProvisioningLossParcelable in the NetworkAttrib..."
Revert "Add new network quirk parcelable in the NetworkAttributes."

Revert submission 1323251-ipv6_prov_loss_quirk_parcelable

Reason for revert: Breaks CtsStrictJavaPackagesTestCases
Reverted Changes:
I18e05c09f:Add new network quirk parcelable in the NetworkAtt...
I8dbff2377:Test IPv6ProvisioningLossParcelable in the Network...

Change-Id: Ie906919b344131cd768fbed787248d3caac2f74d
2020-07-01 01:46:26 +00:00
Xiao Ma
111123c560 Merge "Test IPv6ProvisioningLossParcelable in the NetworkAttributes." 2020-06-29 11:58:24 +00:00
Xiao Ma
0c140bf1ec Test IPv6ProvisioningLossParcelable in the NetworkAttributes.
Bug: 157534516
Test: atest FrameworksNetTests
Change-Id: I8dbff2377457bb8fd0f447be0a3cda9af952f2a2
2020-06-29 11:57:32 +00:00
Paul Hu
6287112701 Merge "[RFPM01] Merge package added/removed methods" 2020-06-29 11:50:57 +00:00
Lorenzo Colitti
ed2ccf0586 Merge "Send ConnDiags event before revalidating network in CS." 2020-06-26 07:13:56 +00:00
Cody Kesting
3d1df816d2 Send ConnDiags event before revalidating network in CS.
This change updates ConnectivityService to notify the
ConnectivityDiagnosticsHandler of app-reported connectivity before
attempting to revalidate the network. This change forces an ordering on
Connectivity Diagnostics events in the case that the reported
connectivity does not match the known connectivity for the network -
this leads to the network being revalidated and the
ConnectivityDiagnostics event onConnectivityReportAvailable. Passing the
onNetworkConnectivityReported event to the
ConnectivityDiagnosticsHandler first ensures that it is passed to
callbacks before any potential ConnectivityReports are.

Bug: 159718782
Test: android.net.cts.ConnectivityDiagnosticsManagerTest
Change-Id: Ic7bc7138c54c47bbfdf56af5811709fde66f8606
2020-06-25 16:57:18 -07:00
Orion Hodson
9ee9dcf07e Merge changes from topic "lnh-platform-split"
* changes:
  Update to use nativehelper/JNIPlatformHelp.h
  Sync with libnativehelper refactoring
2020-06-25 07:36:05 +00:00
Luke Huang
9f5ade331a Merge "Disable sockets and DNS if process lacks INTERNET permission." 2020-06-24 18:42:08 +00:00
Orion Hodson
1c962a802f Update to use nativehelper/JNIPlatformHelp.h
Reflects refactoring of JNI helper code that depends on private
methods within libnativehelper.

Bug: 151443957
Test: Treehugger
Change-Id: I7af128f42ae89a77a8e3fb113ea533331153c535
Merged-In: I7af128f42ae89a77a8e3fb113ea533331153c535
Exempt-From-Owner-Approval: cherry pick
(cherry picked from commit 329c612e3d5ae440bf13e1f5fc9a4012263524e9)
2020-06-24 14:13:49 +01:00
Luke Huang
caaee1d0ec Disable sockets and DNS if process lacks INTERNET permission.
This is a Client-only solution.
  - Add to NetdClient a per-process std::atomic_boolean
    similar to netIdForProcess and netIdForResolv.
  - The boolean says whether the process should be
    allowed Internet connectivity.
  - Add an @hide method to NetUtils.java to set the boolean;
    call it from the initialization code of the new
    process just after forking from zygote.
  - Make netdClientSocket and dnsOpenProxy check the
    boolean. If the boolean is false, return EPERM from
    socket calls.

Bug: 150028556
Test: atest NetworkUtilsTest
Test: atest CtsAppSecurityHostTestCases:UseProcessTest
(cherry-pick from internal branch, ag/11881939)
Merged-In: If002280fbad493dfc2db3d9d505c0257d49a9056
Change-Id: If002280fbad493dfc2db3d9d505c0257d49a9056
2020-06-24 11:58:57 +00:00
Luke Huang
ff0dc5cf49 Move DnsPacket to libs net
This class might be used by some mainline modules.

Bug: 151052811
Test: atest DnsPacketTest
Test: atest DnsResolverTest
(clean cherry-pick from internal branch)
Merged-In: I8841d91456952ded5efbf8ea221289aecc7746ad
Change-Id: I8841d91456952ded5efbf8ea221289aecc7746ad
2020-06-24 11:32:26 +00:00
paulhu
aa4620914e [RFPM01] Merge package added/removed methods
There are two methods to handle package added/removed from
two differnt listeners. It can use one of listener to handle the
changes. Thus, keep PackageManagerInternal#PackageListObserver
but remove the listening from ConnectivityService.

Bug: 132784544
Test: atests FrameworksNetTests
Change-Id: Ib2db85e4108f9fda731bf6667d0af0610fc79fea
2020-06-23 16:10:03 +08:00
Paul Hu
f1140d1a9c Merge "Make PendingIntent immutable and correct Settings package name" 2020-06-23 03:55:22 +00:00
paulhu
7746e4ea2d Make PendingIntent immutable and correct Settings package name
ConnectivityService puts up some notifications with pending
intents, but these pending intents are mutable that content can
be changed by someone. So make these pending intents to be
immutable.

Some OEMs have their own Settings package. Thus, need to get the
current using Settings package name instead of just use default
name "com.android.settings".

Bug: 154928507
Test: atest FrameworksNetTests
Change-Id: I02e3277358623400aa03dc8996af3d7c46a8ce76
Merged-In: I02e3277358623400aa03dc8996af3d7c46a8ce76
2020-06-23 10:05:01 +08:00
Treehugger Robot
1ce8850c27 Merge "Update DnsManagerTest for AIDL interface change" 2020-06-22 15:31:54 +00:00
Ken Chen
fc7dd4c35e 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
Merged-In: Ic53f42b968626294c851dac252a70769846ba427
2020-06-22 15:10:12 +00:00
Mike Yu
6cad4b10db 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
48fbda02b0 Merge "Address comments from aosp/1298476" 2020-06-18 10:18:57 +00:00
Aaron Huang
69bfb5afea 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
3fdad73a32 Merge "Dynamically enable/disable watch for RAT type changes" 2020-06-18 03:51:51 +00:00
Treehugger Robot
d77e15c125 Merge "Treat RouteInfo with different interfaces as different routes" 2020-06-17 12:51:08 +00:00
Rubin Xu
bc4c5caa4f Treat RouteInfo with different interfaces as different routes
On Android different interfaces usually use different routing tables.
As a result, a change in interface should not be treated as route
update, but rather a remove and an add.

This change fixes a bug in VPN seamless handover where routes
failed to be updated when a new tunnel interface replaces the existing
one within the same network.

Bug: 158696878
Test: atest com.android.cts.net.HostsideVpnTests
Test: atest NetworkStackTests
Test: atest CtsNetTestCases
Test: atest FrameworksNetTests
Change-Id: I57987233d42a0253eaee2e1ca5f28728c2354620
2020-06-17 12:01:41 +01:00
Aaron Huang
0543f2328d Merge "Add unit test for NetworkStatsSubscriptionsMonitor" 2020-06-17 08:52:20 +00:00
Aaron Huang
7558938ce9 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
Pavel Grafov
7a952773d1 Connectivity: start PAC global proxy after reboot.
Previously, we read the global proxy settings from Settings.Global
database after reboot. This works for manual proxies, but not for
proxies based on PAC rules, as PacManager is never invoked when
ConnectivityService starts up. As a consequence, services required for
PAC-based proxies (PacService and ProxyService) are never started.

In this CL, we make sure PacManager is called during boot, so that PAC
rules will take effect.

Bug: 35943997
Test: set a PAC proxy and observe it still works after reboot
Change-Id: I69edb5fcd3e84663d338ff4b93c40fd5ee2c8c51
2020-06-17 00:18:34 +01:00
Chiachang Wang
9792742ee0 Merge "Test extra info sent to NetworkMonitor" 2020-06-16 00:38:58 +00:00
Benedict Wong
2f7bb517fd Merge "Set correct owner UID for VPN agentConnect()" 2020-06-15 17:09:46 +00:00
Aaron Huang
b0e7dca43e 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
301bc7b40a 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
Chalard Jean
f60ed54d33 Merge "Document the limitation to a hundred callbacks." 2020-06-11 12:31:09 +00:00
Chalard Jean
a5ff113bff Document the limitation to a hundred callbacks.
Some developers have been surprised by this limitation and had trouble
figuring out what the issue was. Add documentation to address this.

This also includes a drive-by removal of a duplicate check.

Bug: 149867479
Test: doc-only change
Change-Id: I5911d01984695550b6c9afe7a8eb535bf5e320a1
2020-06-11 12:30:21 +00:00
markchien
e9aad6fa2b Cleanup config_mobile_hotspot_provision_app usage
config_mobile_hotspot_provision_app would be move out of framework and
only private for tethering only.
enforceTetherChangePermission is no longer needed because its only
caller PanService already gate by other privileged permission
(BLUETOOTH_PRIVILEGED).

Bug: 146918263
Test: m

Change-Id: I030871c2bc46bc09c4e52970b4995f98d31bb90e
2020-06-10 15:52:24 +00:00
Benedict Wong
bf004e9830 Set correct owner UID for VPN agentConnect()
This commit changes agentConnect to set the owner UID as the mOwnerUid
field instead of the Binder.getCallingUid().

Binder.getCallingUid() can return incorrect results for platform VPNs,
as agentConnect() is called under a clean calling UID.

Additionally, this relaxes the ownerUid sanitization check to allow a
VPN network's owner to see it's own ownership information.

Vpn.mOwnerUid is guaranteed to be correct, as all VPNs MUST have called
prepareInternal() at some previous point, which sets mOwnerUid as the
package's UID (or SYSTEM_UID if this is legacy VPN).

Bug: 150135470
Test: CTS tests showing ownership information
Change-Id: Ic979dad73983d722365849fbfb0becfd432b894c
2020-06-08 14:33:01 -07:00
Xin Li
551b6e094b Merge "Merge QQ3A.200605.002 into master" 2020-06-06 01:41:11 +00:00
Treehugger Robot
d3068f93c3 Merge "Update javadoc to use complete sentence" 2020-06-05 03:02:36 +00:00
Chiachang Wang
6f9c48b81e Merge "Update extra info before registering" 2020-06-05 00:04:04 +00:00
Chiachang Wang
8b60559b7e Update javadoc to use complete sentence
Avoid using the "iff" abbreviation in our Javadoc.

Bug: 158092978
Test: m doc-comment-check-docs and check the generated doc
Change-Id: I41bf8a6ddad200f00524d9b2dd1bf169810ee460
2020-06-04 07:46:14 +00:00
Chiachang Wang
9774ceb3ea Update extra info before registering
The extra info is taken into NetworkMonitor from while creating
it. The NetworkMonitor is created when a new agent is registered
but the extra info is not available at that time. Make sure the
field is set in the NetworkInfo when registering.

Bug: 156173829
Test: adb shell dumpsys network and check the apn in the extra
      info shown correctly
Test: atest FrameworkNetTests
Change-Id: Ieaad8cbf1a28af3b97c7f98f74358e417fcad661
2020-06-03 13:01:01 +08:00
Junyu Lai
528f5debe1 Merge "Disable log for per uid blocked status changed event" am: d66468ca25
Original change: undetermined

Change-Id: I6ba38a19e1ac1d7f3f3eccef76aa10f75273ca47
2020-06-02 09:52:38 +00:00
Junyu Lai
d66468ca25 Merge "Disable log for per uid blocked status changed event" 2020-06-02 09:39:30 +00:00
junyulai
31a6c32056 Disable log for per uid blocked status changed event
This consumes ~3.5% system logs, however it is not very useful
when debugging since similar information could be obtained from
dumpsys {connectivity|netpolicy}. Thus, remove the log.

Test: manual
Bug: 135504481
Change-Id: I04d2b7402f892546722fe6868c521afd9534f183
2020-06-02 14:26:36 +08:00
Maciej Żenczykowski
5b8a4a37af Merge "Add dnsproxyd_protocol_headers for NETID_USE_LOCAL_NAMESERVERS" am: 4bf80c0b90
Change-Id: I4128678546feba6840ddb210244992846705e5d9
2020-06-01 02:14:25 +00:00
Maciej Żenczykowski
4bf80c0b90 Merge "Add dnsproxyd_protocol_headers for NETID_USE_LOCAL_NAMESERVERS" 2020-06-01 02:00:40 +00:00
Luke Huang
c9dcbcd597 Add dnsproxyd_protocol_headers for NETID_USE_LOCAL_NAMESERVERS
NETID_USE_LOCAL_NAMESERVERS is no longer in libnetd_client

Bug: 151895202
Test: build
Change-Id: Iea0c2488dcabdd24d6ffca8134cd11ed12e8308a
Merged-In: Iea0c2488dcabdd24d6ffca8134cd11ed12e8308a
2020-05-30 19:04:44 -07:00
Remi NGUYEN VAN
54c3c2b3c7 Merge "Allow TRANSPORT_TEST ethernet networks" am: 6642ec61c3
Change-Id: Ib9ab1ddb855c90219e94c4b74dc7268cfbcdb661
2020-05-29 21:43:41 +00:00
Benedict Wong
29879886c9 Merge "Add RequiresFeature annotations for IKEv2 VPN profiles" am: de684cfa06
Change-Id: I4a135e75105a49b25b65ba76a3c252467bd9d5ea
2020-05-29 21:41:40 +00:00