Commit Graph

619 Commits

Author SHA1 Message Date
Lorenzo Colitti
349667d173 Merge "Trivial change to test expectations." into oc-mr1-dev am: 9487f80cc5
am: 06e3e912b2

Change-Id: I335fdb5f3053569036608300f8a324a840517cde
2017-08-24 11:17:28 +00:00
Lorenzo Colitti
06e3e912b2 Merge "Trivial change to test expectations." into oc-mr1-dev
am: 9487f80cc5

Change-Id: Iad2aad7163aea9b1b92ed3f46be7ce36cd0578c6
2017-08-24 11:03:38 +00:00
Hugo Benichi
a585b612ff Merge "Make NetworkManagementServiceTest pass again." am: 29b1826ff2 am: d3d6ddea94 am: c933ef6c54
am: dceef06841

Change-Id: I5ec6a8cc3422c1baf107c814f7a60b28fcc71cd5
2017-08-24 04:21:14 +00:00
Hugo Benichi
dceef06841 Merge "Make NetworkManagementServiceTest pass again." am: 29b1826ff2 am: d3d6ddea94
am: c933ef6c54

Change-Id: Ic39262b1f650695cc6903c3a9e2ddb592d47b365
2017-08-24 04:09:14 +00:00
Hugo Benichi
d3d6ddea94 Merge "Make NetworkManagementServiceTest pass again."
am: 29b1826ff2

Change-Id: If7fafa0922fdbc499c0c911a3f88ede9c8a26c1d
2017-08-24 03:46:07 +00:00
Lorenzo Colitti
0fee732ca5 Trivial change to test expectations.
Bug: 32163131
Test: runtest frameworks-net
Change-Id: Iea41c2b50502797f559afd09ded8cedf50dd7c05
2017-08-24 12:43:38 +09:00
Hugo Benichi
29b1826ff2 Merge "Make NetworkManagementServiceTest pass again." 2017-08-24 03:36:20 +00:00
Hugo Benichi
bbadcfd315 Merge "Tethering offload stats updates are eventually consistent"
am: ff12ba9376

Change-Id: I3a8ddc928b60c666faab2991defe8fb7afd0801e
2017-08-24 02:52:42 +00:00
Erik Kline
7c5c7cc570 Merge "Send add/removeDownstream info to offload HAL" into oc-mr1-dev am: 568cd41216
am: 7559e2d2b2

Change-Id: I7abcdcc2d7d967179c47081a6db2b417164891f3
2017-08-24 01:44:31 +00:00
Erik Kline
7559e2d2b2 Merge "Send add/removeDownstream info to offload HAL" into oc-mr1-dev
am: 568cd41216

Change-Id: I0cb81ac054fc2bf6c8b8bfe658e9404a15091d7a
2017-08-24 01:27:46 +00:00
Erik Kline
ed962a8412 Send add/removeDownstream info to offload HAL
Test: as follows
    - built
    - flashed
    - booted
    - "runtest frameworks-net" passed
Bug: 29337859
Bug: 32163131

Change-Id: I6c59aa7cb80b54f376f294b24c1409710c553d74
2017-08-23 15:18:37 -07:00
Lorenzo Colitti
c7a8394ab1 Merge "Don't completely stop offload if setting data limit fails." into oc-mr1-dev am: 9b601f2066
am: 331f8a98df

Change-Id: I464dd2a6d1996b1cfb8bbf82b6ee453fd0747569
2017-08-23 06:05:09 +00:00
Lorenzo Colitti
331f8a98df Merge "Don't completely stop offload if setting data limit fails." into oc-mr1-dev
am: 9b601f2066

Change-Id: I7fc47e60b2da5f39c26fb22c1325618f9948dd38
2017-08-23 05:53:33 +00:00
Lorenzo Colitti
9b601f2066 Merge "Don't completely stop offload if setting data limit fails." into oc-mr1-dev 2017-08-23 05:46:34 +00:00
Hugo Benichi
752c1287bd Tethering offload stats updates are eventually consistent
This patch removes the call to runWithScissors() in
OffloadController#getTetherStats() that was causing a deadlock when
NetworkStatsService would be polled for stats in certain threading
contexts.

Instead of trying to query the tethering offload HAL synchronously all
the time, this patch:
 - changes getTetherStats() to only call into the offload HAL when it
   detects that it is called on the same thread as the Tethering handler
   thread.
 - changes the map of interface to accumulated tethering forwarded stats
   to be concurrent.

This makes stats reading from getTetherStats() eventually consistent.
From the point of view of getTetherStats(), it preserves the guarantees
that tethering stats are monotonically increasing, and also guarantees
no tearing between rx bytes and tx bytes.

Bug: 29337859
Bug: 32163131
Bug: 64771555
Test: runtest frameworks-net
Merged-In: Ibcd351ad0225ef146b00a807833f76d2a886f6c1
Merged-In: I61786d61fe1422e429c0dd9eadaff6f02eb850e7
Merged-In: I999d1d1bf72e7ab02c5d17f37aad00bc711d3fc5

(cherry pick from commit eb5e465edd)

Change-Id: I28646b962cee8c8a6efd66059f84873c02ac5810
2017-08-23 09:58:09 +09:00
Lorenzo Colitti
a086800e04 Make NetworkManagementServiceTest pass again.
1. Mock the service manager so that NMS can fetch mock versions
   of INetd and IBatteryStats.
2. Call LocalServices.removeServiceForTest to avoid a duplicate
   service registration error. // check this
3. Change the timeout from 100ms to 200ms, as otherwise the tests
   that check for IfaceClass fail.
4. Convert NetworkManagementServiceTest to JUnit 4.
5. Move NetworkManagementServiceTest to tests/net

Bug: 29337859
Bug: 32163131
Bug: 32561414
Bug: 62918393
Test: runtest frameworks-net
Change-Id: Ic7371b427b35809ccd446addf35c9d8ae99ccfd3
2017-08-23 09:49:05 +09:00
Lorenzo Colitti
96ae2a0694 Merge "Tethering offload stats updates are eventually consistent" into oc-mr1-dev am: 45fb339d83
am: e3aeae68f3

Change-Id: I999d1d1bf72e7ab02c5d17f37aad00bc711d3fc5
2017-08-22 22:38:06 +00:00
Lorenzo Colitti
e3aeae68f3 Merge "Tethering offload stats updates are eventually consistent" into oc-mr1-dev
am: 45fb339d83

Change-Id: I61786d61fe1422e429c0dd9eadaff6f02eb850e7
2017-08-22 22:19:36 +00:00
Lorenzo Colitti
45fb339d83 Merge "Tethering offload stats updates are eventually consistent" into oc-mr1-dev 2017-08-22 22:06:46 +00:00
Hugo Benichi
eb5e465edd Tethering offload stats updates are eventually consistent
This patch removes the call to runWithScissors() in
OffloadController#getTetherStats() that was causing a deadlock when
NetworkStatsService would be polled for stats in certain threading
contexts.

Instead of trying to query the tethering offload HAL synchronously all
the time, this patch:
 - changes getTetherStats() to only call into the offload HAL when it
   detects that it is called on the same thread as the Tethering handler
   thread.
 - changes the map of interface to accumulated tethering forwarded stats
   to be concurrent.

This makes stats reading from getTetherStats() eventually consistent.
From the point of view of getTetherStats(), it preserves the guarantees
that tethering stats are monotonically increasing, and also guarantees
no tearing between rx bytes and tx bytes.

Bug: 29337859
Bug: 32163131
Bug: 64771555
Test: runtest frameworks-net
Change-Id: Ibcd351ad0225ef146b00a807833f76d2a886f6c1
2017-08-22 19:31:31 +09:00
Lorenzo Colitti
d743601a00 Don't completely stop offload if setting data limit fails.
Currently, if setting a data limit fails, we completely stop
offload in order to avoid data overages. However, the next thing
we do is try to fetch the stats and crash, because once offload
is stopped all our local state is cleared.

Fix this by fetching stats before we stop offload.

Bug: 29337859
Bug: 32163131
Bug: 64867836
Test: OffloadControllerTest passes
Test: no crash when disabling wifi tethering with BT tethering active
Change-Id: I260f5450f8b67f055983af68fb23a5f3cfc0bc69
2017-08-22 18:09:02 +09:00
Hugo Benichi
f525708438 Merge "IpManager: use InitialConfiguration for provisioning" am: 5b218bdc8e am: c6a9b5564a am: e869136a54 am: f7c02563ee
am: 4b884096a5

Change-Id: Iceab8f4f6b438564f444410487f8f4ace84181fd
2017-08-21 12:57:26 +00:00
Hugo Benichi
4b884096a5 Merge "IpManager: use InitialConfiguration for provisioning" am: 5b218bdc8e am: c6a9b5564a am: e869136a54
am: f7c02563ee

Change-Id: I80439f92cad469ac77c11430727e5207e75cf432
2017-08-21 12:41:28 +00:00
Hugo Benichi
386f3aee13 IpManager: use InitialConfiguration for provisioning
This patch changes IpManager to take into account static provisioning
information specified in the InitialConfiguration for IPv6 static
configuration.

When a valid InitialConfiguration with IPv6 content is specified,
IpManager will do the following things:

- at start(), it will push the IPv6 addresses in the config to netd
- it will observe all addresses be notified via Netlink
- when all addresses are there, it will patch in the associated IPv6
  routes in the config, so that they get passed to ConnectivityService
  through the usual mechanism

The logic triggering onProvisioningSuccess is also changed to take into
account InitialConfiguration: when all addresses and all routes in the
config are seen the provisioning is successful.

Bug: 62988545
Test: runtest frameworks-net, with newly added tests
Merged-In: I77ed7c576c4b198de7a4726be70c78b74689e98b
Merged-In: I131589680b68222e4fda4e9165ac2f50894ee28e
Merged-In: I6e42d26ae430c213f65e466a2c556760ff0e14eb
Merged-In: I8e9c6de63697b8c3f41480d69309360763119838
Merged-In: I80439f92cad469ac77c11430727e5207e75cf432

(cherry picked from commit d00ddf5672)

Change-Id: I7b1ced13361f49a92b10174486de9a1f70dd68d1
2017-08-21 21:37:29 +09:00
Hugo Benichi
f7c02563ee Merge "IpManager: use InitialConfiguration for provisioning" am: 5b218bdc8e am: c6a9b5564a
am: e869136a54

Change-Id: I8e9c6de63697b8c3f41480d69309360763119838
2017-08-21 12:29:53 +00:00
Hugo Benichi
e869136a54 Merge "IpManager: use InitialConfiguration for provisioning" am: 5b218bdc8e
am: c6a9b5564a

Change-Id: I6e42d26ae430c213f65e466a2c556760ff0e14eb
2017-08-21 12:19:08 +00:00
Hugo Benichi
c6a9b5564a Merge "IpManager: use InitialConfiguration for provisioning"
am: 5b218bdc8e

Change-Id: I131589680b68222e4fda4e9165ac2f50894ee28e
2017-08-21 12:08:28 +00:00
Hugo Benichi
d00ddf5672 IpManager: use InitialConfiguration for provisioning
This patch changes IpManager to take into account static provisioning
information specified in the InitialConfiguration for IPv6 static
configuration.

When a valid InitialConfiguration with IPv6 content is specified,
IpManager will do the following things:

- at start(), it will push the IPv6 addresses in the config to netd
- it will observe all addresses be notified via Netlink
- when all addresses are there, it will patch in the associated IPv6
  routes in the config, so that they get passed to ConnectivityService
  through the usual mechanism

The logic triggering onProvisioningSuccess is also changed to take into
account InitialConfiguration: when all addresses and all routes in the
config are seen the provisioning is successful.

Bug: 62988545
Test: runtest frameworks-net, with newly added tests
Change-Id: I77ed7c576c4b198de7a4726be70c78b74689e98b
2017-08-21 16:00:31 +09:00
Lorenzo Colitti
b9fc12d1d2 Merge changes I325b13d5,I89719fe7 am: 23868e9c09 am: 9335d2d0b1
am: 4fa0187015

Change-Id: Ib980879b0e50ffe1c8209339df22da4a50d5b74e
2017-08-19 03:38:10 +00:00
Lorenzo Colitti
4fa0187015 Merge changes I325b13d5,I89719fe7 am: 23868e9c09
am: 9335d2d0b1

Change-Id: Iac0d1a08c45816f32b0f8ab81a079883a9965e21
2017-08-19 03:25:21 +00:00
Lorenzo Colitti
9335d2d0b1 Merge changes I325b13d5,I89719fe7
am: 23868e9c09

Change-Id: Iaced543ab17ea87c8f701975764d957bc1b17fc7
2017-08-19 03:15:08 +00:00
Treehugger Robot
23868e9c09 Merge changes I325b13d5,I89719fe7
* changes:
  Add tether offload traffic to interface stats as well.
  Tell the system when tethering offload hits a limit.
2017-08-19 03:05:14 +00:00
Lorenzo Colitti
203c935d74 Merge "Add tether offload traffic to interface stats as well." into oc-mr1-dev am: 21bc3a39a4
am: 1af850fdfe

Change-Id: I2b586b84c44126e1d3b9097950a41decaa5216cc
2017-08-19 01:12:35 +00:00
Lorenzo Colitti
f1912ca49a Add tether offload traffic to interface stats as well.
Currently, we only count add tethering traffic to per-UID
stats, but not to total data usage (i.e., dev and XT stats). This
is correct for software tethering, because all software forwarded
packets are already included in interface counters, but it is
incorrect for hardware offload, because such packets do not
increment interface counters.

To fix this:
1. Add an argument to ITetheringStatsProvider#getTetherStats to
   indicate whether per-UID stats are requested. For clarity,
   define integer constants STATS_PER_IFACE and STATS_PER_UID
   to represent these operations.
2. Make NetdTetheringStatsProvider return stats only if per-UID
   stats are requested. (Otherwise tethering traffic would be
   double-counted).
3. Make OffloadController's stats provider return the same
   stats regardless of whether per-UID stats were requested or
   not.
4. Make NetworkStatsService add non-per-UID tethering stats to
   the dev and XT snapshots. The per-UID snapshots were already
   correctly adding in per-UID stats.

(cherry picked from commit 5356a35c3b)

Bug: 29337859
Bug: 32163131
Test: runtest frameworks-net
Test: runtest frameworks-telephony
Change-Id: I325b13d50e88841dfb0db4c35e7e27f163ee72fe
Merged-In: I4e8e923d68dce1a4a68608dbd6c75a91165aa4ee
2017-08-19 10:12:05 +09:00
Lorenzo Colitti
1af850fdfe Merge "Add tether offload traffic to interface stats as well." into oc-mr1-dev
am: 21bc3a39a4

Change-Id: I4e8e923d68dce1a4a68608dbd6c75a91165aa4ee
2017-08-19 01:02:33 +00:00
Lorenzo Colitti
21bc3a39a4 Merge "Add tether offload traffic to interface stats as well." into oc-mr1-dev 2017-08-19 00:54:59 +00:00
Lorenzo Colitti
5356a35c3b Add tether offload traffic to interface stats as well.
Currently, we only count add tethering traffic to per-UID
stats, but not to total data usage (i.e., dev and XT stats). This
is correct for software tethering, because all software forwarded
packets are already included in interface counters, but it is
incorrect for hardware offload, because such packets do not
increment interface counters.

To fix this:
1. Add an argument to ITetheringStatsProvider#getTetherStats to
   indicate whether per-UID stats are requested. For clarity,
   define integer constants STATS_PER_IFACE and STATS_PER_UID
   to represent these operations.
2. Make NetdTetheringStatsProvider return stats only if per-UID
   stats are requested. (Otherwise tethering traffic would be
   double-counted).
3. Make OffloadController's stats provider return the same
   stats regardless of whether per-UID stats were requested or
   not.
4. Make NetworkStatsService add non-per-UID tethering stats to
   the dev and XT snapshots. The per-UID snapshots were already
   correctly adding in per-UID stats.

Bug: 29337859
Bug: 32163131
Test: runtest frameworks-net
Test: runtest frameworks-telephony
Change-Id: I7a4d04ab47694d754874136179f8edad71099638
2017-08-19 00:21:56 +09:00
Lorenzo Colitti
9f0baa94ca Tell the system when tethering offload hits a limit.
Add a new tetherLimitReached method to INetworkManagementService,
and call it when the HAL notifies OffloadController because the
limit has been reached.

Bug: 29337859
Bug: 32163131
Test: builds
Test: OffloadControllerTest passes

(cherry picked from commit d66cf56ba6)

Change-Id: I89719fe7ec8bfd3c85d6cdca9c0d449aea86ef9d
Merged-In: I026e6aa9e7b371f316c0d97c3cf5e78abc1f5263
2017-08-19 00:15:31 +09:00
Hugo Benichi
322df2899b Merge "Add convenience methods to IpPrefix and LinkAddress" into oc-mr1-dev 2017-08-17 22:31:59 +00:00
Lorenzo Colitti
8a977784bb Merge "Tell the system when tethering offload hits a limit." into oc-mr1-dev am: c3e7f875b4
am: 9515b36ffa

Change-Id: I2b5027ed54d0847da00dbb749adfb446cb7d784d
2017-08-17 09:29:43 +00:00
Lorenzo Colitti
9515b36ffa Merge "Tell the system when tethering offload hits a limit." into oc-mr1-dev
am: c3e7f875b4

Change-Id: I026e6aa9e7b371f316c0d97c3cf5e78abc1f5263
2017-08-17 09:14:27 +00:00
TreeHugger Robot
c3e7f875b4 Merge "Tell the system when tethering offload hits a limit." into oc-mr1-dev 2017-08-17 09:06:57 +00:00
Charles He
478b2b7cbf Merge "Opt-out for always-on VPN: rename API." into oc-mr1-dev am: 8b2513e439
am: 337ee0771e

Change-Id: Ib4eca8d5ea79e5ac65496bee8390e5ce4cd8fb64
2017-08-17 08:12:56 +00:00
Charles He
337ee0771e Merge "Opt-out for always-on VPN: rename API." into oc-mr1-dev
am: 8b2513e439

Change-Id: Ie511c6f1034b75b4e797dbc0ca31c7c5c30f336e
2017-08-17 08:01:53 +00:00
Charles He
8b2513e439 Merge "Opt-out for always-on VPN: rename API." into oc-mr1-dev 2017-08-17 07:54:05 +00:00
Lorenzo Colitti
d66cf56ba6 Tell the system when tethering offload hits a limit.
Add a new tetherLimitReached method to INetworkManagementService,
and call it when the HAL notifies OffloadController because the
limit has been reached.

Bug: 29337859
Bug: 32163131
Test: builds
Test: OffloadControllerTest passes
Change-Id: I0304e555544ee18c83244672766c767cbad650a1
2017-08-17 15:33:18 +09:00
Hugo Benichi
6e833f27aa Add convenience methods to IpPrefix and LinkAddress
Also moving relevant test files into tests/net as part of runtest
framworks-net.

Also removes testHashCode in LinkAddress() because this test relies on
the assumption that hashCode() is stable across releases or jdk
versions, which is absolutely not true.

This creates maintenance work for little benefit since hashCode is
already tested as part of the equality test.

For instance this test is now broken because hashing for InetAddress
changed.

Bug: 62988545
Bug: 62918393
Test: runtest frameworks-net, added coverage in tests
Merged-In: I695bc3f0e801bf13bc4fc0706565758f12b775b4
Merged-In: I6d3f3c50eaec44e3a0787e849ab28e89f6f4a72d
Merged-In: Iddfec82a08f845e728adadfa6ec58a60a078d6af
Merged-In: I8d6dd5efd226a8b1c4b05d1e1102362b58e094a1
Merged-In: Ied0cc53ac34c7c5f5539507b1979cbf9c215262e
Merged-In: I3b2b7dcb1a9a194fc08643b27bbb5a0e84e01412

(cherry picked from commit 1dfb6b6755)

Change-Id: I9a17094bfdc54b9dec671306618e132a4beb59fc
2017-08-17 11:03:24 +09:00
Android Build Merger (Role)
9a13a242bc Merge "Merge "Merge "Add convenience methods to IpPrefix and LinkAddress" am: 2ad60c88f1 am: ea2defe62b am: 4d7787a310 am: e9291de0c4" into oc-mr1-dev-plus-aosp am: 4351aecb2d" 2017-08-16 19:28:20 +00:00
Hugo Benichi
b5c5b9d36c Merge "Merge "Add convenience methods to IpPrefix and LinkAddress" am: 2ad60c88f1 am: ea2defe62b am: 4d7787a310 am: e9291de0c4" into oc-mr1-dev-plus-aosp
am: 4351aecb2d

Change-Id: I3b2b7dcb1a9a194fc08643b27bbb5a0e84e01412
2017-08-16 19:22:46 +00:00
Charles He
1af40a942b Merge "Unbreak VPN unit tests." 2017-08-16 19:05:49 +00:00