Commit Graph

328 Commits

Author SHA1 Message Date
Remi NGUYEN VAN
7055e64685 Merge "Do not mark in-process NetworkStack as persistent" into qt-dev
am: 0a51e93a9b

Change-Id: I0734281d0793426f6c9c8f2b1cd1bdd69eefad7c
2019-05-16 22:32:58 -07:00
Remi NGUYEN VAN
0a51e93a9b Merge "Do not mark in-process NetworkStack as persistent" into qt-dev 2019-05-17 02:29:16 +00:00
Remi NGUYEN VAN
a95544d9a8 Do not mark in-process NetworkStack as persistent
The in-process NetworkStack runs in the system process, so it does not
need to be marked persistent.
Doing so causes a spurious com.android.networkstack.inprocess process to
be running, wasting memory.

Bug: 131046856
Test: Flashed sailfish, networking works, no extra process started
Test: Flashed walleye, networking still works
Test: aapt dump xmltree NetworkStack.apk AndroidManifest.xml unchanged
Change-Id: I0eb896c825ffe2581950c0bdd2b31ebd7eae0982
2019-05-16 18:21:54 +09:00
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
Remi NGUYEN VAN
678d4ea608 Merge "Add build targets for non-mainline NetworkStack" into qt-dev
am: bca73ac0c6

Change-Id: I18504341411e0dd2385e0fd25b940e3ad1acb74b
2019-05-15 04:14:58 -07: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
Chiachang Wang
4b5f3a313c Merge "Fix a bug where private DNS to v4-only servers don't validate." am: b846759154
am: 5f7aee0050

Change-Id: I362d43ee6af318694a4038a257e1ebb3f577863c
2019-05-15 03:27:57 -07:00
Chiachang Wang
b846759154 Merge "Fix a bug where private DNS to v4-only servers don't validate." 2019-05-15 09:52:50 +00:00
Chiachang Wang
0f449289da Fix a bug where private DNS to v4-only servers don't validate.
Bug: 132670008
Test: Manual
Test: atest NetworkStackTests
Change-Id: I8ae6fa6f3800f5f6c9ee88ffe3b8ada34b96dee6
(cherry picked from commit aea0808d3b26dab24005afc39eb7ec4f4f333bae)
2019-05-15 16:18:56 +08: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
Aaron Huang
ec92b94320 Merge "apf: Remove IPv6 NAT-T keepalive related codes and ApfTest improvement" am: 4d492d89fa
am: 24f14ed21b

Change-Id: If01bc6a71cf26e13edc049d969d23088fa8242e4
2019-05-14 23:52:26 -07:00
Aaron Huang
4d492d89fa Merge "apf: Remove IPv6 NAT-T keepalive related codes and ApfTest improvement" 2019-05-15 06:17:43 +00:00
Richard Uhler
7ac31f4c9f Merge "Use embedded native libs for NetworkStack.apk." into qt-dev
am: 0ef7b0d46e

Change-Id: I831c4519806dd8e7149a6a2ea29208815770fb47
2019-05-14 07:26:01 -07:00
Richard Uhler
87462d79ff 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
Merged-In: I7c9a1702a2c18e0333b5e409f04b7658fe685f97
(cherry picked from commit 103dbe38b4)
2019-05-14 15:18:01 +01:00
TreeHugger Robot
0ef7b0d46e Merge "Use embedded native libs for NetworkStack.apk." into qt-dev 2019-05-14 14:04:37 +00:00
Aaron Huang
d287837d98 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: Ifb9e088c0c8d71c763ebd9ad122103d0f97ca278
2019-05-14 19:58:16 +08:00
Remi NGUYEN VAN
70c97d9fbe Merge "Have InProcessNetworkStack override NetworkStack" into qt-dev
am: 6fe150832e

Change-Id: Ia7e126424f13d3ddd897c506b473f28fe2b6d709
2019-05-14 03:02:01 -07: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
2493db8396 Merge "Dropping NAT-T keepalive packet from APF" am: c4104f029f
am: 917c9f146b

Change-Id: Ib3416ec37f0de12daf882068e00673ad60438c1a
2019-05-13 04:52:48 -07:00
Aaron Huang
c4104f029f Merge "Dropping NAT-T keepalive packet from APF" 2019-05-13 11:33:37 +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
Aaron Huang
a746964854 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: I1c537485e11b31e5a6e0d8b7b6a1f396f9441746
2019-05-10 22:41:48 +08:00
Aaron Huang
07f32d0d6d Merge "Send message to add/remove NAT-T keepalive packet filter." am: 42e73893e0
am: 99b6c3f485

Change-Id: I7c6bd151cd79309fb5e6869fd83a800e7425581a
2019-05-10 07:30:01 -07:00
Aaron Huang
42e73893e0 Merge "Send message to add/remove NAT-T keepalive packet filter." 2019-05-10 13:57:11 +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
Chalard Jean
414b8c8b1c Merge "Support strict mode private DNS on VPNs that provide Internet." am: a56eab41a6
am: 549439cc92

Change-Id: I28cc679def7cdd4dc5187e65f4524c3998ebcafc
2019-05-10 04:33:43 -07:00
Chalard Jean
a56eab41a6 Merge "Support strict mode private DNS on VPNs that provide Internet." 2019-05-10 09:39:17 +00:00
Chiachang Wang
40c5295cee Merge "Use async dns query to resolve all addresses" am: a956364754
am: 4306080f49

Change-Id: I2b7e184d9b9800a83b55dceb73af69085668748c
2019-05-10 02:26:23 -07:00
Lorenzo Colitti
80986d9a53 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
2019-05-10 14:30:54 +09: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
Chiachang Wang
e37f8729d1 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: I9f50da3c8c2e3b12b29bc8844291e4bf1559cd1f
2019-05-09 21:28:47 +08: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
Lorenzo Colitti
669dc6cea7 Merge "Switch to positive naming for NetworkMonitor's Networks." am: abfef61707
am: 51aa3312b2

Change-Id: Ia24d6cee89a635d410921e87d4c53f519d7e5ebd
2019-05-09 05:33:27 -07:00
Lorenzo Colitti
89909befd2 Merge "Add tests for strict mode private DNS validation." am: 6a4ae85e23
am: baee9317b5

Change-Id: I53ab6d9d30fa581347cf5aed4091d6a968946cd9
2019-05-09 05:27:29 -07:00
Lorenzo Colitti
abfef61707 Merge "Switch to positive naming for NetworkMonitor's Networks." 2019-05-09 11:57:50 +00:00
Lorenzo Colitti
6a4ae85e23 Merge "Add tests for strict mode private DNS validation." 2019-05-09 11:57:25 +00:00
Xiao Ma
c4e4fd7bee Merge "adopt non-blocking method to obtain the IpMemoryStore service." am: b340a6988b
am: c657a844ea

Change-Id: If0d43f21710ca31149610d3e6a5f0d7e4acc11a2
2019-05-09 04:55:13 -07:00
Lorenzo Colitti
ac12b84ef0 Switch to positive naming for NetworkMonitor's Networks.
"mNonPrivateDnsBypassNetwork" is not very easy to understand.

Bug: 122652057
Test: atest FrameworksNetTests NetworkStackTests
Change-Id: If5801c81c6ef222b46f631bd6570dcd0fea465bd
2019-05-09 17:58:49 +09:00
Lorenzo Colitti
62f3e53f68 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
2019-05-09 17:58:48 +09:00
Xiao Ma
a489a8d495 adopt non-blocking method to obtain the IpMemoryStore service.
Test: atest FrameworksNetTests
Change-Id: I7de4f23370bdf9c9df5e74ed074c794080d93d95
2019-05-09 10:39:50 +09:00
Aaron Huang
706ff1b00c 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

Change-Id: Ic97ffe9ff5781778efd264460809f5059f0f4230
2019-05-06 19:52:48 +08:00
Baligh Uddin
ef4808551d Merge "Update version number to 220000000" into qt-dev 2019-05-05 16:35:35 +00:00