Commit Graph

690 Commits

Author SHA1 Message Date
Remi NGUYEN VAN
524ea05e39 Increase network request timeouts
With recent performance degradations on apct, the current timeouts are
too short and some requests trigger onUnavailable() before networks are
validated.

Test: runtest -x ConnectivityServiceTest.java
Bug: b/111778226
Change-Id: I083f529787f108065637a0aff3e5bb88e05e6510
2018-07-27 15:37:13 +09:00
Remi NGUYEN VAN
626885b750 Use timeout consts in all ConnService tests
Fix some timeouts that were forgotten in parent CL.

Bug: b/111778226
Test: runtest --no-hidden-api-checks -x ConnectivityServiceTest.java
Change-Id: Ib848eaba8c69c07ac596aa4386a741c9a2a87fc9
2018-07-27 11:47:25 +09:00
Remi NGUYEN VAN
3b498060f6 Merge "Increase linger delay and test callback timeout"
am: 0544dfde7e

Change-Id: I088de7dae4191a65e75feb9e071dcf18c30dcf21
2018-07-26 04:10:02 -07:00
Remi NGUYEN VAN
b6bd15ac29 Increase linger delay and test callback timeout
Tests appear to have become much slower on apct in recent runs, although
local runs do not seem to be affected. As a first measure, increase our
timeouts to eliminate flakyness.

Bug: b/111778226
Test: runtest --no-hidden-api-checks -x ConnectivityServiceTest.java
Change-Id: I7a3bfb646eb554bcd9d50d026142f2a2cff74beb
2018-07-26 16:43:58 +09:00
Remi NGUYEN VAN
6cbacfa17e Merge "Increase TEST_LINGER_DELAY_MS"
am: 9a783699cc

Change-Id: Iff68ee39ead571293877464c03ab98ab594dfcca
2018-07-24 22:05:37 -07:00
Remi NGUYEN VAN
50cb7dbc11 Increase TEST_LINGER_DELAY_MS
The current timeout is short enough that lingered networks are torn down
before assertions can be run, causing flakyness in testMultipleLingering.
This CL sets the timeout to 300 in that particular test.

Verified that 300ms is enough with 500 successful runs on Sailfish.

An alternative would be to mock firing of the lingering timer, but
keeping the WakeupMessage logic realistic has already proven useful in
detecting races.

Bug: b/110673602
Test: runtest --no-hidden-api-checks frameworks-net
Change-Id: I6f9a656190bcff0b071ae2584d0f5fa74158472b
2018-07-19 17:12:38 +09:00
Chalard Jean
e71a3833fe Merge "Add StackedLinkProperties test case"
am: faf31f8638

Change-Id: I33d75bf593708317dca4ba6cec035b7f035cfa86
2018-06-20 21:23:17 -07:00
junyulai
74f9a8b52a Add StackedLinkProperties test case
Change access level of getNetworkAgentInfoForNetwork in ConnectivityService to get
better testability. And add test case to verify clat state transition and make sure
linkProperties are updated correctly.

Bug: 80261579, 109913107
Test: runtest frameworks-net -c com.android.server.ConnectivityServiceTest \
          -m testStackedLinkProperties
Change-Id: I72fce594d74bd349f65557edca03640e1b86317c
2018-06-19 16:53:08 +08:00
Nathan Harold
1db89848ab Disable the AppOp Restriction for IpSec Tunnels
This CL temporarily removes the AppOp restriction
that disallows creation of IpSec tunnels due to
the lack of the appropriate AppOp in AOSP/master.
When the relevant framework merges out to master,
this CL should be reverted.

Manually merging this due to skipping a merge
conflict at 9fe9ec18c1

Bug: none
Test: compilation
Change-Id: Ic06c193f85f6bcdd0ead4238825c1add78703cde
2018-06-08 23:23:04 +00:00
nharold
ff904be7a9 Merge changes from topic "ipsec-sync-with-pi"
* changes:
  Disable the AppOp Restriction for IpSec Tunnels
  Rework Exception Handling for IpSecManager
  Update IpSecManager to use InetAddress and prefixLen
  Add AppOps Checks for MANAGE_IPSEC_TUNNELS
  Add MANAGE_IPSEC_TUNNELS Permission
2018-06-08 17:07:11 +00:00
Nathan Harold
71fc014f00 Disable the AppOp Restriction for IpSec Tunnels
This CL temporarily removes the AppOp restriction
that disallows creation of IpSec tunnels due to
the lack of the appropriate AppOp in AOSP/master.
When the relevant framework merges out to master,
this CL should be reverted.

Bug: none
Test: compilation
Change-Id: Ic06c193f85f6bcdd0ead4238825c1add78703cde
2018-06-07 18:44:34 -07:00
Benedict Wong
ba38f8b79f Update IpSecManager to use InetAddress and prefixLen
LinkAddress constructors are currently @hide; this change updates
IpSecManager to use InetAddress and prefixLen, and then construct a
LinkAddress internally. LinkAddress is used over the binder interface to
IpSecService to ensure validity.

Bug: 77528639
Test: CTS, Java unit tests ran on walleye
Merged-In: I19e124adef6d9f4992d8293db3190bcf74c95848
Change-Id: I19e124adef6d9f4992d8293db3190bcf74c95848
(cherry picked from commit 2ea91aee42)
2018-06-07 18:42:52 -07:00
Nathan Harold
2a9b2c8165 Add AppOps Checks for MANAGE_IPSEC_TUNNELS
Adds support for a new AppOp to permit services to
use IpSec tunnel mode. The IpSecService now needs
a context so change the service mode to a cached
service rather than a static service.

Bug: 66955045
Test: runtest frameworks-net
Merged-In: I17a4a286225b432c3e15ea1587d946189931b4f4
Change-Id: I17a4a286225b432c3e15ea1587d946189931b4f4
(cherry picked from commit 68a7edf1cb)
2018-06-07 18:42:52 -07:00
Chalard Jean
ec3d62faa5 Unify behavior of various cases of "no underlying networks"
Before this change, VPNs having no underlying networks would be
marked as metered as the safe option, but VPNs having only
disconnected underlying networks would be marked as unmetered.
Fix this discrepancy.

Clean cherry-pick of ag/4113809

Bug: 79748782
Test: runtest frameworks-net
Change-Id: Ie6ace6bd95139605ffcfa8cd6c15cf28f8fa28c8
Merged-In: If19b85325e7d684e645470293b3c8a674084c641
Merged-in: I22f80a6a39d4a19ff74aa61fcbd66f1a041b1003
2018-06-06 08:25:10 +00:00
Chalard Jean
22670f9b93 Fix: VPNs update caps upon underlying network disconnect.
Clean cherry-pick of ag/4083954

Bug: 79748782
Test: ConnectivityServiceTests still pass
Change-Id: I21e866c723099e5c3dee54ff13e830d44427fc7a
Merged-In: I12c948ebeb2b74290908f8320ff77220dc4a9fb9
2018-06-06 08:25:02 +00:00
Chalard Jean
32f9daa029 Add tests for setUnderlyingNetworks.
Fixes come later. This is complex enough as it is.

Clean cherry-pick of ag/4083953

Bug: 79748782
Test: new test passes, old tests still pass
Change-Id: If7276fe1f751be7b9c18f689e97699e566e5bde0
Merged-In: I12c948ebeb2b74290908f8320ff77220dc4a9fb9
2018-06-06 08:24:51 +00:00
Chalard Jean
52a6d547b7 Fix setCapabilities.
P introduced setSSID, UIDs and unwanted capabilities.
None of these exhibit commutative behavior through combineCapabilities
because their semantics don't allow it. Therefore
NetworkRequest.setCapabilities() is badly broken around any of
these. Look at the comments in the new tests to realize the
extent of the damage.

Clean cherry-pick of ag/4083952

Bug: 79748782
Test: new tests written, old tests pass
Change-Id: Iafe074126132a82af37f4bf056c4a7b8d56bdc83
Merged-In: Ia5bebf8a233775367bbf1b788870528934ecbcfb
Merged-In: I13d7782a6c0c7b1f94137995bbb0d257a58d89c1
2018-06-06 08:24:43 +00:00
Chalard Jean
818f6b5c6a Make sure getActiveNetwork is consistent with default callbacks
Almost clean cherry-pick of ag/3889538.

Bug: 77737389
Test: runtest framework-net
      new test don't pass without the main code change, but they
      do with it
Change-Id: I0cd83a935ab0b349aa47e065b830e5a43ab9a091
Merged-In: Iaa0285825735d3f16bba6e4946723a437fd9b0b9
Merged-In: Ia8f985b448251f911484e6bd63fa562bffc1b0e4
2018-06-06 08:24:21 +00:00
Chalard Jean
d94e48ff95 Add tests for getActiveNetwork.
Clean cherry-pick of ag/3918295
One-line adjustment for ag/3638326 which has not been put in AOSP.

Bug: 77737389
Test: runtest frameworks-net
Change-Id: I03ae2bbb08559f2cd44979e291c1f5d50eb215da
Merged-In: Iaa0285825735d3f16bba6e4946723a437fd9b0b9
Merged-In: Ia8f985b448251f911484e6bd63fa562bffc1b0e4
2018-06-06 08:24:12 +00:00
Chalard Jean
390bee5f2c Add a new ssid field in NetworkCapabilities.
Clean cherry-pick of ag/3887737

Bug: 77891227
Test: frameworks-net
Change-Id: Icefe1657bca52b913a72b56705342a7285769658
Merged-In: Ia1f4e51b7c2e9118789242cf6d9e7576c4167cda
Merged-In: I6dd1aba6fde5a502b4a9145cf16393d8ce623c89
2018-06-06 08:23:52 +00:00
Remi NGUYEN VAN
bbfe4d043f Merge "Migrating remaining core networking tests to Junit4" 2018-05-25 03:27:39 +00:00
Remi NGUYEN VAN
3f6d2b08ad Merge changes I3b3bcbbd,I18b3f263,I3c416c1a
* changes:
  Use CaptivePortalProbeSpec method in portal app
  Add configurable captive portal probes
  Move CaptivePortalProbeResult to its own file
2018-05-24 07:53:00 +00:00
Hugo Benichi
e17657c0f1 Migrating remaining core networking tests to Junit4
Bug: 62918393
Test: runtest frameworks-net
Merged-In: I30f7eaa0307b8fad5a8de7a0da235a4f76c18677
(clean cherry-pick of I30f7eaa0307b8fad5a8de7a0da235a4f76c18677)

Change-Id: I272fea0bb4a9e7f6252bb3bd14a6b769a082039e
2018-05-24 16:24:47 +09:00
Remi NGUYEN VAN
f3eae13de9 Move CaptivePortalProbeResult to its own file
This is necessary to resolve visibility issues for the next change.

Bug: b/79499239
Test: runtest frameworks-net
Merged-In: Ia48b32307a51a66f2672d7112f71166dd6db41b1
Merged-In: I5df7ee9f16bc6be4f02353d40a843a383dd4cbd9
(Clean cherry-pick of pi-dev I50bc96afe6ae88c8f58a693f0a4e821f1f9b3299)

Change-Id: I3c416c1a91ebfdf914fd528ff8ab73e3eb490562
2018-05-24 12:04:27 +09:00
Chalard Jean
8edc5b4398 Merge "Unify behavior of various cases of "no underlying networks"" into pi-dev
am: 468fdc3dd2

Change-Id: I22f80a6a39d4a19ff74aa61fcbd66f1a041b1003
2018-05-22 05:19:52 -07:00
Chalard Jean
9eee2c33d4 Merge changes Ic8231b18,I30009f88 into pi-dev
am: 200cad09c7

Change-Id: I12c948ebeb2b74290908f8320ff77220dc4a9fb9
2018-05-22 04:06:35 -07:00
Chalard Jean
f90bb339f5 Unify behavior of various cases of "no underlying networks"
Before this change, VPNs having no underlying networks would be
marked as metered as the safe option, but VPNs having only
disconnected underlying networks would be marked as unmetered.
Fix this discrepancy.

Bug: 79748782
Test: runtest frameworks-net
Change-Id: I51c3badde29f43f692f383553bd98327d2da8dd1
2018-05-22 18:50:00 +09:00
Chalard Jean
d4f01cadc0 Fix: VPNs update caps upon underlying network disconnect.
Bug: 79748782
Test: ConnectivityServiceTests still pass
Change-Id: Ic8231b18a17e6feb5ebafe8d5688fb59f9d4d58e
2018-05-22 18:49:58 +09:00
Chalard Jean
e2b9a76574 Add tests for setUnderlyingNetworks.
Fixes come later. This is complex enough as it is.

Bug: 79748782
Test: new test passes, old tests still pass
Change-Id: I30009f88e68a534c332ca88bae517cacc39a60bb
2018-05-22 18:25:33 +09:00
Remi NGUYEN VAN
a9ba4a9d29 Merge "Move CaptivePortalProbeResult to its own file" into pi-dev
am: 11d94b5742

Change-Id: Ia48b32307a51a66f2672d7112f71166dd6db41b1
2018-05-22 01:09:08 -07:00
Chalard Jean
2e7a6c1b8f Merge "Fix setCapabilities." into pi-dev
am: cb42feb502

Change-Id: I13d7782a6c0c7b1f94137995bbb0d257a58d89c1
2018-05-22 01:01:39 -07:00
Remi NGUYEN VAN
11d94b5742 Merge "Move CaptivePortalProbeResult to its own file" into pi-dev 2018-05-22 08:00:56 +00:00
Chalard Jean
cb42feb502 Merge "Fix setCapabilities." into pi-dev 2018-05-22 07:51:09 +00:00
Remi NGUYEN VAN
cabd8329f3 Move CaptivePortalProbeResult to its own file
This is necessary to resolve visibility issues for the next change.

Bug: b/79499239
Test: runtest frameworks-net
Change-Id: I50bc96afe6ae88c8f58a693f0a4e821f1f9b3299
2018-05-22 10:00:28 +09:00
Chalard Jean
e15627ef72 Fix setCapabilities.
P introduced setSSID, UIDs and unwanted capabilities.
None of these exhibit commutative behavior through combineCapabilities
because their semantics don't allow it. Therefore
NetworkRequest.setCapabilities() is badly broken around any of
these. Look at the comments in the new tests to realize the
extent of the damage.

Bug: 79748782
Test: new tests written, old tests pass
Change-Id: Ie46581bdaf9ecc2f14aab44788bbdb27a3fec8c1
2018-05-21 14:46:40 +09:00
Erik Kline
0e5c8f2092 Merge "Add explicit override for default Private DNS mode" into pi-dev
am: 2b3c858296

Change-Id: If480ab40c7cf9ab75c52feafc28338a049cbceef
2018-05-18 01:08:26 -07:00
Erik Kline
a7edf6ff56 Add explicit override for default Private DNS mode
Test: as follows
    - built
    - flashed
    - booted
    - runtest frameworks-net passes
Bug: 79719289
Change-Id: I943c5476666e47d04690626e2133f501cb875b46
2018-05-17 17:41:12 +09:00
Remi NGUYEN VAN
80770e423c Merge "Fix testRegisterUsageCallback" am: 899283d833
am: bc3a7a5ba5

Change-Id: If16708b5ce00dc374663e3c3dedd1d96342175f1
2018-05-08 02:13:00 -07:00
Remi NGUYEN VAN
899283d833 Merge "Fix testRegisterUsageCallback" 2018-05-08 07:55:42 +00:00
android-build-team Robot
24596473b7 Merge changes from topic "ifaceStatsDetail" into pi-dev
* changes:
  Remove the unused file parsing function
  Use eBPF map data for per iface stats
2018-05-02 19:17:27 +00:00
Remi NGUYEN VAN
b1ff5a381e Fix testRegisterUsageCallback
noteOp (introduced in go/ag/3897834) checks that the calling uid matches
the calling package, which is not correct when using a fake calling
package. Use the real package of the test so permissions are checked
properly.

The test currently only fails this way in pi-dev as noteOp is only used
in pi-dev.
Change-Id: I9ac3717af9335ba9efa0b8842a2df0d7b69ec9ab
Test: Fixed test now passes in pi-dev
Bug: b/78487385
2018-05-02 16:51:13 +09:00
android-build-prod (mdb)
feed20b4e9 Merge changes from topic "ifaceStats" am: 3f675c25e0
am: 7df94359d4

Change-Id: I460bc25806182bc2dc5fcc2512ab01e776a0e8e6
2018-05-01 19:53:30 -07:00
Chenbo Feng
cf7567ba7a Remove the unused file parsing function
With the new xt_bpf support for iface stats. We no longer need to parse
the per interface stats from /proc/net/dev. And since the old xt_qtaguid
code path also not depend on it, we can completly remove that helper
function since no caller is depending on it now.

Bug: 72111305
Test: runtest frameworks-net -c com.android.internal.net.NetworkStatsFactoryTest
Change-Id: Icb7eaeef0eeb9fdffd32a90316c76ee05bafffbe
Merged-In: Icb7eaeef0eeb9fdffd32a90316c76ee05bafffbe
(cherry picked from aosp commit b815c978b81eee4b1494bd0b9d25bfad52f08b72)
2018-05-01 19:48:03 -07:00
Chenbo Feng
84c1437111 Remove the unused file parsing function
With the new xt_bpf support for iface stats. We no longer need to parse
the per interface stats from /proc/net/dev. And since the old xt_qtaguid
code path also not depend on it, we can completly remove that helper
function since no caller is depending on it now.

Bug: 72111305
Test: runtest frameworks-net -c com.android.internal.net.NetworkStatsFactoryTest
Change-Id: Icb7eaeef0eeb9fdffd32a90316c76ee05bafffbe
2018-05-01 14:13:55 -07:00
Chalard Jean
70be7a9dd0 Let DnsManager fill in LinkProperties for private DNSes
(clean cherry-pick from ag/3880157)

Test: new tests pass
Bug: 73641539
Change-Id: I971ef4d27b22a435d7459e1c4b31a8715ef6e610
Merged-In: I837df61e3c277ae08ebf4fdcd4c4e9ac8c550811
Merged-In: I72ecaa4f7d7320ffa2e0ba82fadafc947c8a6981
2018-04-27 13:32:10 +09:00
Chalard Jean
299d856143 Add the list of private DNS addresses to LinkProperties
(clean cherry-pick from ag/3874803)

Test: atest android.net.LinkPropertiesTest, also new tests pass
Bug: 73641539
Change-Id: If33a35b1354a67db09411ff098f20064797296ad
Merged-In: I4b739c56e658690532ae9deb0b9a3bc9b2adf8b0
Merged-In: I6bdbef78d078d68534c8e07e9af031ce374560ef
2018-04-27 13:32:10 +09:00
Chalard Jean
6093933b48 Merge changes I0cd83a93,I03ae2bbb into pi-dev
am: 411e79b8b0

Change-Id: Iaa0285825735d3f16bba6e4946723a437fd9b0b9
2018-04-24 03:02:11 -07:00
Chalard Jean
46adcf3089 Make sure getActiveNetwork is consistent with default callbacks
Bug: 77737389
Test: runtest framework-net
      new test don't pass without the main code change, but they
      do with it
Change-Id: I0cd83a935ab0b349aa47e065b830e5a43ab9a091
2018-04-24 17:32:00 +09:00
Chalard Jean
fd424b90be Add tests for getActiveNetwork.
Bug: 77737389
Test: runtest frameworks-net
Change-Id: I03ae2bbb08559f2cd44979e291c1f5d50eb215da
2018-04-24 15:23:28 +09:00
Chalard Jean
89af2956e6 Merge "Let DnsManager fill in LinkProperties for private DNSes" into pi-dev
am: 2a915264a6

Change-Id: I837df61e3c277ae08ebf4fdcd4c4e9ac8c550811
2018-04-23 00:33:21 -07:00