Commit Graph

250 Commits

Author SHA1 Message Date
Aaron Huang
2913482e08 Merge "apf: Remove IPv6 NAT-T keepalive related codes and ApfTest improvement" into qt-dev 2019-05-15 15:27:14 +00:00
Aaron Huang
7afeb17fb2 Merge "Dropping NAT-T keepalive packet from APF" into qt-dev 2019-05-15 15:26:56 +00:00
Chiachang Wang
036871beb8 Merge "Fix a bug where private DNS to v4-only servers don't validate." into qt-dev 2019-05-15 11:56:10 +00:00
Chiachang Wang
3134eb413f Fix a bug where private DNS to v4-only servers don't validate.
Bug: 132670008
Test: Manual
Test: atest NetworkStackTests
Change-Id: I8ae6fa6f3800f5f6c9ee88ffe3b8ada34b96dee6
Merged-In: I362d43ee6af318694a4038a257e1ebb3f577863c
2019-05-15 10:40:22 +00:00
Aaron Huang
4a40e911d0 apf: Remove IPv6 NAT-T keepalive related codes and ApfTest improvement
Remove IPv6 related codes since we don't support IPv6 NAT-T keepalive
as the kernel doesn't support IPv6 UDP encapsulation.

Renaming keepaliveAck to keepaliveResponce since NAT-T keeaplive
response is not an ack. Also, add generateV4NattKeepaliveFilters()
if multicast filter is disabled.

Verify incoming packet contains 1 byte payload but it is not 0xff will
pass NAT-T keepalive filter.

Bug: 33530442
Test: atest FrameworksNetTests
      atest NetworkStackTests

Change-Id: I6d3eb9e6271a0f51dec4a55d68a69b4280175d86
Merged-In: I6d3eb9e6271a0f51dec4a55d68a69b4280175d86
Merged-In: If01bc6a71cf26e13edc049d969d23088fa8242e4
(cherry picked from commit 4ee521b022)
2019-05-15 07:26:54 +00:00
Remi NGUYEN VAN
fc4a83bd4b Add build targets for non-mainline NetworkStack
Add PlatformCaptivePortalLogin and PlatformNetworkPermissionConfig build
targets to override CaptivePortalLogin and NetworkPermissionConfig with
platform-key-signed packages easily. The added packages are unused by
default but can simplify setup for OEMs that use InProcessNetworkStack.

Bug: 132635211
Test: Added the new packages to sailfish build, built image: device has
      the proper packages signed with the right keys, networking and
      captive portal working fine.

Change-Id: I09656deb6ba928f56b478adebb60268fa6f484b0
2019-05-15 16:14:51 +09:00
TreeHugger Robot
0ef7b0d46e Merge "Use embedded native libs for NetworkStack.apk." into qt-dev 2019-05-14 14:04:37 +00:00
Remi NGUYEN VAN
3cc6d236c3 Have InProcessNetworkStack override NetworkStack
This avoids shipping both APKs on Go devices, as would be previously
done with the default Go configuration that still included NetworkStack.

Test: Flashed, booted walleye with svelte config. Verified that
      NetworkStack is not on the device and InProcessNetworkStack is
      used. WiFi working.
Bug: 132666298
Change-Id: If4a7a003128a555e512c88469653c3fb2ad864d5
2019-05-14 07:31:50 +00:00
Richard Uhler
103dbe38b4 Use embedded native libs for NetworkStack.apk.
So that the /system version of NetworkStack.apk can be re-installed on
/data without causing problems. This is useful for testing and necessary
for supporting rollback to the system version of NetworkStack.apk.

Bug: 131703417
Bug: 132195177
Test: Confirm NetworkStack.apk now includes .so files.
Test: adb install --staged NetworkStack.apk
      adb reboot
      Device reboots without problems.

Change-Id: I7c9a1702a2c18e0333b5e409f04b7658fe685f97
2019-05-13 16:08:58 +01:00
Aaron Huang
56f9e417c8 Dropping NAT-T keepalive packet from APF
Add NAT Traversal keepalive filter to APF program to
drop NAT-T keepalive packets when NAT-T keepalive
offload is starting.

Bug: 33530442
Test: - atest NetworkStackTests
      - atest FrameworksNetTests

Change-Id: If62ba7fdb5f0f0f0a7a59ec169e82b4e3147eedd
Merged-In: If62ba7fdb5f0f0f0a7a59ec169e82b4e3147eedd
Merged-In: Ib3416ec37f0de12daf882068e00673ad60438c1a
(cherry picked from commit 95538d2d6b)
2019-05-13 12:15:14 +00:00
Aaron Huang
aedc602ebe Send message to add/remove NAT-T keepalive packet filter.
Remove definition of TYPE_NATT and TYPE_TCP since the type
can be identified by checking message.obj is an instance of
NattKeepalivePacketData or TcpKeepalivePacketData.
It's more simple and won't have dependency on KeepaliveInfo.

Bug: 33530442
Test: atest FrameworksNetTests
      atest NetworkStackTests

(Clean cherry-pick of aosp/955419)

Change-Id: Ic97ffe9ff5781778efd264460809f5059f0f4230
Merged-In: Ic97ffe9ff5781778efd264460809f5059f0f4230
2019-05-13 18:48:19 +08:00
TreeHugger Robot
0491e45466 Merge "Use async dns query to resolve all addresses" into qt-dev 2019-05-10 15:38:32 +00:00
Chiachang Wang
2d5847b06b Use async dns query to resolve all addresses
Currently, it looks like private DNS server resolution uses
OneAddressPerFamilyNetwork and only returns one server address.
It should return all addresses. Use async dns api for this.

Bug: 123435238
Test: atest NetworkStacktests

Change-Id: I2b7e184d9b9800a83b55dceb73af69085668748c
(cherry picked from commit 40c5295cee)
Merged-In: I2b7e184d9b9800a83b55dceb73af69085668748c
Merged-In: I9f50da3c8c2e3b12b29bc8844291e4bf1559cd1f
2019-05-10 13:49:15 +00:00
Chalard Jean
f98611062c Support strict mode private DNS on VPNs that provide Internet.
Currently, strict mode private DNS does not work on VPNs because
NetworkMonitor does not validate VPNs. When a VPN connects, it
immediately transitions to ValidatedState, skipping private DNS
hostname resolution.

This change makes NetworkMonitor perform private DNS hostname
resolution and evaluation even on VPNs.

In order to ensure that the system always immediately switches to
the VPN as soon as it connects, remove the unvalidated penalty
for VPN networks. This ensures that the VPN score is always 101
and the VPN always outscores other networks as soon as it
connects. Previously, it would only outscore other networks
when no-op validation completed.

Bug: 122652057
Test: atest FrameworksNetTests NetworkStackTests
Test: manually ran a VPN with private DNS in strict mode
atest android.net.cts.ConnectivityManagerTest com.android.cts.net.HostsideVpnTests
Change-Id: Iaa78a7edcf23755c89d7b354edbc28d37d74d891
Merged-In: Iaa78a7edcf23755c89d7b354edbc28d37d74d891
(cherry picked from commit 414b8c8b1c)
2019-05-10 13:09:00 +00:00
Xiao Ma
3ce093b527 adopt non-blocking method to obtain the IpMemoryStore service.
Bug: 131133347
Test: atest FrameworksNetTests
Merged-In: I7de4f23370bdf9c9df5e74ed074c794080d93d95
Merged-In: If0d43f21710ca31149610d3e6a5f0d7e4acc11a2

Change-Id: If0d43f21710ca31149610d3e6a5f0d7e4acc11a2
(cherry picked from commit c4e4fd7bee)
2019-05-10 00:55:14 +00:00
Lorenzo Colitti
c52bc221a7 Switch to positive naming for NetworkMonitor's Networks.
"mNonPrivateDnsBypassNetwork" is not very easy to understand.

Bug: 122652057
Test: atest FrameworksNetTests NetworkStackTests
Change-Id: If5801c81c6ef222b46f631bd6570dcd0fea465bd
Merged-In: If5801c81c6ef222b46f631bd6570dcd0fea465bd
(cherry picked from commit 669dc6cea7)
2019-05-09 12:36:02 +00:00
Lorenzo Colitti
ab3611bc08 Add tests for strict mode private DNS validation.
Test successful and failed validation, and updating the config.
In order to do this, add a FakeDns class so we can change DNS
responses dynamically while the test is running.

Also a couple of minor fixes:
1. Make sure the DNS timeout is set. Before this CL, it was
   always 0. Not sure why. It does seem to be set to the default
   value (12500) when actually running on device. We didn't
   catch this because the only tests that use the timeout set it
   explicitly.
2. Make runNetworkTest a bit more realistic: always send
   NetworkCapabilities *before* calling notifyNetworkConnected.
   This is what ConnectivityService does.

Bug: 122652057
Test: atest FrameworksNetTests NetworkStackTests
Test: atest --generate-new-metrics 50 NetworkStackTests:com.android.server.connectivity.NetworkMonitorTest
Change-Id: Ifd6694262501874f3261c864a049cb35c6afb9c8
Merged-In: Ifd6694262501874f3261c864a049cb35c6afb9c8
(cherry picked from commit 89909befd2)
2019-05-09 12:35:18 +00:00
Baligh Uddin
ef4808551d Merge "Update version number to 220000000" into qt-dev 2019-05-05 16:35:35 +00:00
Dario Freni
6615e145f6 Merge "Revert "Revert "Make the network stack a persistent process.""" into qt-dev 2019-05-03 02:12:05 +00:00
Dario Freni
fbe8278145 Revert "Revert "Make the network stack a persistent process.""
This reverts commit f6315c2e3c.

Reason for revert: Change I346d772e1f4aed94f6faead3b6455efc4666b651 implemented a feature to allow upgrading persistent processes via staged installs.

Bug: 131046856
Test: - adb install networkstack.apk fails
      - adb install --staged networkstack.apk succeds (after reboot)
Change-Id: I13af35c953c0501f2b129092e0089d4e893b97a1
2019-05-02 22:51:01 +00:00
Lorenzo Colitti
3d680e887b Make NetworkStack actually build in an unbundled setup.
The Java code was already using sdk_version: "current", but the
JNI library did not have an sdk_version attribute, and had
forbidden dependencies on internal libraries such as libcutils,
liblog and libnativehelper.

This CL fixes things as follows:
- Use the NDK log functions, and switch to the NDK liblog.
- Switch to the NDK libnativehelper.
- Drop the dependencies on libcutils and libpcap, which were
  unused.
- Use the libc++ STL, and set the sdk_version of the library to
  current.

Bug: 131703417
Test: m
Test: installed NetworkStack APK via "adb install --staged" results in working networking
Test: builds, boots, wifi works
Test: atest FrameworksNetTests NetworkStackTests
Change-Id: I1a7bd7fe2809b90a66073d8c5d5dcdff646c4286
2019-05-01 19:10:43 +09:00
Mark Chien
d0f8ca8126 Support adding NATT keepalive packet filter
Support adding NATT keepalive packet filter to APF
filter.
Generating APF program will be addressed in another CL.

Bug: 33530442
Test: - atest NetworkStackTests
      - atest FrameworksNetTests

Change-Id: I403cd14ac9aa6b001c4e580abbb33a615931a192
Merged-In: Idaa7238a5c9acdae9f6cff13095ee9436c7c92c8
(cherry picked from commit 038c11d564)
2019-04-30 11:26:26 +08:00
Lorenzo Colitti
a7df107e06 Merge "Revert "Make the network stack a persistent process."" into qt-dev 2019-04-29 07:08:32 +00:00
Lorenzo Colitti
f6315c2e3c Revert "Make the network stack a persistent process."
This reverts commit 796afddd6c.

Reason for revert: breaks updatability because persistent processes are not updatable.

Bug: 131046856
Change-Id: I35ded113b31e742f13ad8523a10af3a83a111374
Merged-In: I35ded113b31e742f13ad8523a10af3a83a111374
(cherry picked from commit b2a5d85522)
2019-04-29 02:02:11 +00:00
Lorenzo Colitti
a7af412694 Fix some checkstyle nits in DhcpPacketTest.
Use the Generated code suppression comment filter instead of the
IndentationCheck suppression comment filter because the latter
complains that '+' should be on a new line.

Bug: 120584519
Bug: 127423755
Test: atest NetworkStackTests
Test: atest FrameworksNetTests
Change-Id: I35b8c943b95a4301c25b7f6cfb02f03a8c1bc34e
Merged-In: I60071bc029d25485bf204cfd3a8cebd538ca12b6
(cherry picked from commit 65f6ae271b)
2019-04-29 10:54:54 +09:00
Lorenzo Colitti
4d92d76567 Additional code for server name in DHCP packets.
- Add the hostname to DhcpResultsParcelable.
- Don't store the server hostname if option overload is in use,
  as this is not valid.
- Add unit tests.

Bug: 120584519
Bug: 127423755
Test: atest NetworkStackTests
Test: atest FrameworksNetTests
Change-Id: I5e9fee5471740f5d7c001e9e98017f32be452344
Merged-In: I60071bc029d25485bf204cfd3a8cebd538ca12b6
(cherry picked from commit 681f33cc6a)
2019-04-29 10:54:42 +09:00
yuanyunli
e84b833609 Parse the server host name field of the dhcp package
Some hotspot devices will fill in the server host name field of the DHCP
package, such as iphone. Parsing the server host name of the DHCP
package can help identify ios hotspots.

Bug: 120584519
Test: 127423755
Test: builds, boots, wifi works
Change-Id: I8c5a7dc8ab117f062f9401f58832edada321436b
Merged-In: I60071bc029d25485bf204cfd3a8cebd538ca12b6
(cherry picked from commit 43f1bc9d53)
2019-04-29 10:54:28 +09:00
Akshay
38efbb623d Update version number to 220000000
The Beta 3 builds (which are in dogfood an public beta) will receive modules via the Play Store with version numbers 210000000. Hence, we must bump the version in qt-dev and hence beta 4.

BUG: 131240537
Change-Id: I4f09986002f660896dbc1f8a0482c16b4a554d1e
2019-04-26 17:04:37 -07:00
Lorenzo Colitti
7d04541c1a Make the network stack a persistent process.
The network stack should never be killed, because if it does,
recovering networking requires a reboot. Make the process
persistent to reduce the chances of it being killed by the OOM
killer.

Bug: 131046856
Test: builds, boots
Test: process oom_score_adj is -800
Test: process goes from "Persistent Service" to "Persistent" in dumpsys meminfo
Change-Id: Ic8ebf6356e23489f6cd984d680ff9f1b4cbbe52d
Merged-In: Ic8ebf6356e23489f6cd984d680ff9f1b4cbbe52d
(cherry picked from commit c1eedfcd12)
2019-04-25 00:59:13 +00:00
Lorenzo Colitti
59db1d5f40 Delete unused timeout constant.
Test: m
Bug: 129312219
Change-Id: I5b4c8b42dea515f674ff10d64d0e1d06d849cca1
Merged-In: I5b4c8b42dea515f674ff10d64d0e1d06d849cca1
(cherry picked from commit 21c692d717)
2019-04-24 12:35:32 +00:00
TreeHugger Robot
c84e33b3f1 Merge "Remove Settings constants for NetworkStack" into qt-dev 2019-04-24 11:46:25 +00:00
Lorenzo Colitti
d575cbfa34 Allow overlaying the DNS probe timeout.
Test: m
Bug: 129312219
Change-Id: I84461d40e4d2e63ce8c111c047cbc085cb49443e
2019-04-24 05:54:33 +00:00
Lorenzo Colitti
28c966eaa9 Add a timeout for the DNS probe.
Bug: 129312219
Test: atest NetworkStackTests
Test: atest --generate-new-metrics 50 NetworkStackTests:com.android.server.connectivity.NetworkMonitorTest
Change-Id: Ib3ab9105d7ae39f551b51e8d5a04b9ec5e549655
Merged-In: Ib3ab9105d7ae39f551b51e8d5a04b9ec5e549655
(cherry picked from commit c7204f689d)
2019-04-24 05:41:02 +00:00
Xiao Ma
f69bf6338d Add overlay tag for default dns servers.
Bug: 130324939
Test: m && flashall && verified dns servers resource has been changed.
Change-Id: Ic897d066567e7c826a18959e1dcc1260f82b4013
2019-04-24 03:29:17 +00:00
Lorenzo Colitti
e8660ef639 Freeze the networkstack-aidl-interfaces interface
This freezes the interface as of the latest beta build, not the tip of
tree. IIpClient#setL2KeyAndGroupHint is not in the frozen definition in
particular.

Generated with:
m networkstack-aidl-interfaces-freeze-api \
    ipmemorystore-aidl-interfaces-freeze-api

Test: flashed, booted, WiFi and captive portal working
Bug: 128803828
Change-Id: Ideabe73fc93bbefca2d624ee9ca190cf31419424
Merged-In: Ideabe73fc93bbefca2d624ee9ca190cf31419424
(cherry picked from commit 9b89cdaaf4)
2019-04-23 09:41:44 +00:00
TreeHugger Robot
27ad19ee9e Merge "provide a resource overlay to configure customized DNS Server." into qt-dev 2019-04-23 09:05:45 +00:00
Chiachang Wang
4dd1b47b0b Remove Settings constants for NetworkStack
The definitions reference of these constants are moved from
Settings to DeviceConfig. These definitions are @hide and the
usage in the Settings are removed. Thus, remove the definitions
from API level.

Bug: 123167629
Test: make system-api-stubs-docs-update-current-api \
      test-api-stubs-docs-update-current-api
Test: atest NetworkStackTests
Change-Id: I28c4bf2c0b72e154cea91d11007a9497c7f21570
2019-04-23 09:32:14 +08:00
Chiachang Wang
9509eb8716 Merge "Move Setting constants for NetworkStack" into qt-dev 2019-04-22 10:37:10 +00:00
Chiachang Wang
98b02db88e Move Setting constants for NetworkStack
From mainline perspective, we should use android flag api
instead of using Settings. Thus, move the definitions into
NetworkStack and apply new flag design.

Bug: 123167629
Test: atest NetworkStackTests
Change-Id: I9602263f0bff5d8e942bd652de69ccfcb3034a2f
Merged-In: I6820300c412f94989a5fce7bd6c6f2a3b983b96e
Merged-In: I4f6d130ffbee14f5087d75a8bc211680a34be682
(cherry picked from commit 01440ea909)
2019-04-19 05:29:51 +00:00
Remi NGUYEN VAN
7035b7949c Change the validation URL for Chinese SIMs
The default HTTPS and fallback validation URLs are not accessible from
China, so users in China never get a validated network on WiFi with the
default AOSP settings. OEMs selling devices targeting China typically
change the check URLs for that reason.

When the device uses a Chinese SIM card, change the default validation
URLs to URLs accessible accessible from China as of now.

Test: inserted China SIM, WiFi off/on, dumpsys network_stack shows new
      URL used
Bug: 111819230
Change-Id: Ib7f41f470ef1a9c7712f2477ebfab44e915cf1b9
Merged-In: Ib7f41f470ef1a9c7712f2477ebfab44e915cf1b9
(cherry picked from commit 990ea84d2d)
2019-04-18 13:30:00 +00:00
Remi NGUYEN VAN
5410580108 Merge "Add overlayable tag for NetworkStackConfig" into qt-dev 2019-04-18 05:36:34 +00:00
Chalard Jean
6a76b7e2e4 Move TrafficStats tags for the network stack constants
As per API council feedback, these constants should live in
a place that is private to the network stack, only with a
range defined in system API.

Bug: 129433383
Test: m
Change-Id: I84a90f84a9af6fef4667ee4d512ebd0413222086
(cherry picked from commit 79a6330650ca04bd7a08afbd63f8016a3b30bc72)
2019-04-16 00:41:54 +09:00
Remi NGUYEN VAN
d361ff3cb9 Freeze netd AIDL interface (framework)
This freezes the interface as of the latest beta build, although it has
not changed since then.
This change adds the necessary implementations for getInterfaceVersion.

Test: flashed, WiFi working
Bug: 128803828
Merged-In: Ib852b0555f0e20b858f9dd0b16dbd98dbbd22b55
Merged-In: I0c231bdce89474b53603cc15d55787c8c78a809d
(cherry picked from commit fd4eafe8f6)

Change-Id: Idc0e7ea98dbf57e07ee578bc1772c2111af2e563
2019-04-12 03:34:02 +00:00
Chiachang Wang
f5d37ae877 Merge "Address nit in NetworkStackUtils" into qt-dev 2019-04-12 03:15:00 +00:00
Xiao Ma
3741fdc5b9 provide a resource overlay to configure customized DNS Server.
Bug: 122621524
Test:  atest FrameworksNetTests NetworkStackTests
Merged-In: I123b3d4516cc6ba6d17629eb74daf448ba7121eb
Merged-In: Iba867a3b7bda1f5db9dfa1b7521d4a4badbf88e0
(cherry picked from commit ac7eb77b90)

Change-Id: Iab8b57ae1bc81c12ce07f849c7820977a9061d55
2019-04-12 02:32:08 +00:00
Chiachang Wang
44d36f6be3 Address nit in NetworkStackUtils
Follow up commit to fix nit in aosp/937891

Bug: 120013793
Test: Build
Change-Id: I61a6306d3c439a2d72323ab56e2b47771cc60d48
Merged-In: Ide4741305724a9e0d26305f8406c5445f9de12b3
(cherry picked from commit cfb4e06b14)
2019-04-12 01:01:50 +00:00
Chiachang Wang
e512b26913 Migrate NetworkStack metrics off StatsLog.write
Now that the new metrics API can be used, NetworkStack
metrics need to migrate off the legacy StatsLog.write.

Bug: 130323000
Test: Test with ./out/host/linux-x86/bin/statsd_testdrive 121
      to ensure log properly
Test: Ensure NetworkStackStatsLog will be generated as expected
Test: atest NetworkStackTest

Change-Id: I8c70503cf1d9f1d06f30a1936d2d88857d0cff53
2019-04-11 21:24:28 +08:00
Lorenzo Colitti
5beebde64d Add lifecycle tests to NetworkMonitorTest
- Ensure that NetworkMonitor quits when notifyNetworkDisconnected
  is called.
- Ensure that BroadcastReceivers are registered when a captive
  portal is detected and unregistered when the network validates
  or when NetworkMonitor quits.

Bug: 122164725
Test: atest FrameworksNetTests NetworkStackTests
Test: atest --generate-new-metrics 10 NetworkStackTests:com.android.server.connectivity.NetworkMonitorTest
Test: test fails if "Don't leak captive portal broadcast receivers." change reverted
Change-Id: I1202626face33cc1e1ec02016b95da487b3335c8
Merged-In: I1202626face33cc1e1ec02016b95da487b3335c8
(cherry picked from commit bb41c8f751)
2019-04-11 11:52:27 +00:00
Remi NGUYEN VAN
e0603420f8 Merge "Expose captive portal urls for configuration" into qt-dev 2019-04-11 03:44:08 +00:00
Remi NGUYEN VAN
1f8e5289c8 Add overlayable tag for NetworkStackConfig
This allows OEMs to customize the added resources with an overlay APK
installed in the product, system or vendor partition.

Bug: 111819230
Test: Installed test APK, verified resources changed. Resources not
      mentioned in overlayable file were not changed.

Change-Id: I24670005ea940d2ac29b8a0ff93e1559604fd3a8
2019-04-11 03:32:43 +00:00