Commit Graph

444 Commits

Author SHA1 Message Date
Lorenzo Colitti
0128c7f4fa Merge changes Id8776d14,Ifa291c62,I5ea9d200 am: 76715955e0 am: fd496bf6ad
am: 51fdc7870c

Change-Id: I12108d96e29bfe71406106c2af950a6d6a9f8351
2018-01-19 16:46:11 +00:00
Treehugger Robot
76715955e0 Merge changes Id8776d14,Ifa291c62,I5ea9d200
* changes:
  Track and persist in stats whether traffic is on the default network.
  Add the default network to NetworkStats and NetworkStatsCollection.
  Pass all default networks to NetworkStatsService
2018-01-19 14:48:52 +00:00
Lorenzo Colitti
e2e04f14d5 Track and persist in stats whether traffic is on the default network.
This change adds the defaultNetwork to the ident based on current
system networking state, and persists that value to flash.

Bug: 35142602
Test: runtest frameworks-net
Test: downloaded files using default/non-default networks while watching dumpsys netstats
Change-Id: Id8776d149b2977548a9eb455ad4926af55e25aba
2018-01-19 19:49:16 +09:00
Lorenzo Colitti
e9a6d36fb3 Add the default network to NetworkStats and NetworkStatsCollection.
This allows us to maintain NetworkStats entries that track
whether the traffic was on the default network.

At the moment, the stats collection code always passes in
DEFAULT_NETWORK_NO. However, this value is a no-op, since it is
not persisted to disk. Only the ident, the uid/set/tag, and the
packet/byte/operation counters are persisted.

A future change will add defaultNetwork to the ident and start
persisting it.

Bug: 35142602
Test: runtest frameworks-net
Change-Id: Ifa291c62c0fa389b88e5561086a29dcd7cee2253
2018-01-19 19:49:16 +09:00
Lorenzo Colitti
a9dcce5a67 Pass all default networks to NetworkStatsService
This will allow NetworkStatsService to treat traffic on these
networks differently from traffic where the app selects a network
that is not the default.

Bug: 35142602
Test: runtest frameworks-net
Change-Id: I5ea9d200d9fb153490c6108bb9390bf152f297da
2018-01-19 16:40:10 +09:00
Jeff Sharkey
d879ce75f5 Merge "Add "not congested" network capability." am: f2ca25f0cb am: b5d8ecb02b
am: 76a671b688

Change-Id: I836fedeab34f34a43e0257e395fca1f735bc6d61
2018-01-18 04:20:44 +00:00
Lorenzo Colitti
392819336e Merge "Add public API methods for private DNS." am: 05b54efcb3 am: d5b2824f06
am: 84c003df97

Change-Id: Icd04bc83624ea4d13ac7737e6f9a7b0c5f0f7314
2018-01-18 03:36:37 +00:00
Jeff Sharkey
f2ca25f0cb Merge "Add "not congested" network capability." 2018-01-18 03:28:34 +00:00
Lorenzo Colitti
05b54efcb3 Merge "Add public API methods for private DNS." 2018-01-18 01:17:17 +00:00
nharold
5a826ab8ff Merge "IpSec - API Tweak for removeTransportModeTransform" am: dc88d02119 am: 71aa19dcbf
am: 9e5c53789f

Change-Id: I479c24d9ac5d4b022ec6310395fdb4274cfd5598
2018-01-17 20:50:14 +00:00
dalyk
83b5fa28ec Add public API methods for private DNS.
Test: Small modifications to LinkProperties test.
Bug: 71828272
Change-Id: Id2f5acb5469132ec4a917837739f42085c71498e
2018-01-17 15:46:21 -05:00
nharold
dc88d02119 Merge "IpSec - API Tweak for removeTransportModeTransform" 2018-01-17 19:07:10 +00:00
nharold
c6fd947728 Merge changes from topic "ipsec-oneway-transform" am: 6987ca3620 am: 6e22cf92e6
am: 553288c304

Change-Id: I2a90cf423a3ac9a0526831ef767ad019e7be053c
2018-01-17 10:07:33 +00:00
Nathan Harold
befb36b962 Make Transforms Unidirectional am: a47ac2bb32 am: 9bbf7ac609
am: 8534382fa6

Change-Id: I608be255a307891ec3fe2d97cda817d75240c95c
2018-01-17 10:03:31 +00:00
Nathan Harold
9bbf7ac609 Make Transforms Unidirectional
am: a47ac2bb32

Change-Id: I7e80c75b3b227fdd16479120d8b7203cc5f28d1c
2018-01-17 09:37:57 +00:00
Jeff Sharkey
d616b20c17 Add "not congested" network capability.
Can be used by a network to indicate when it's congested, meaning that
apps should defer network traffic that could be done at a later time.

Test: bit FrameworksNetTests:android.net.,com.android.server.net.,com.android.server.connectivity.VpnTest,com.android.server.ConnectivityServiceTest
Bug: 64133169
Change-Id: I8a60b6f02dd0f42268b59690556c16335d34e220
2018-01-17 02:27:04 -07:00
Nathan Harold
2c97b2e3af IpSec - API Tweak for removeTransportModeTransform
Because IpSecTransforms are now unidirectional,
and because the only mechanism for removing Transforms
removes it from both directions, the API can no longer
use the Transform parameter to meaningfully validate
that the caller had applied a transform. Since that
functionality was as-yet unimplemented and is now
infeasible, the transform parameter is removed.

Bug: 72079356
Test: cts - IpSecManagerTest; runtest frameworks-net
Change-Id: If19b0d34bdc6daf31a40d6d62bff326dcbca08c0
2018-01-17 01:11:46 -08:00
nharold
6987ca3620 Merge changes from topic "ipsec-oneway-transform"
* changes:
  Update IpSecService UnitTests
  Make Transforms Unidirectional
2018-01-17 08:40:37 +00:00
Nathan Harold
e0d099dfb3 Update IpSecService UnitTests
The IpSecService Unit tests relied on the
directionality of the IpSecConfig and previously
did not specify a source address. Unit tests
updated without functional change other than to
address these two requirements.

Bug: 71717213
Test: runtest frameworks-net
Change-Id: Iedbed735bc50fd4fdfe985f9e173956062a7b0d1
2018-01-16 19:38:10 -08:00
Nathan Harold
a47ac2bb32 Make Transforms Unidirectional
Convert the IpSecTransform from being a bi-directional
pair of SAs to a unidirectional single SA. This CL
also removes the concept of "direction from SAs meaning
that a IpSecTransform may now be applied to a socket
in either direction.

-Make transforms unidirectional
-Add Convert allocateSpi() to use destination rather
 than direction and remote address
-Remove directionality from builders for IpSecTransform
-Change applyTransportModeTransform() to take a
 direction in which to apply the transform object.
-Additional minor naming updates
-Restrict IpSecConfig to only print keys on eng builds
-Move DIRECTION constants to IpSecManager
-Add sourceAddress parameter to IpSecTransform to provide
 additional guarantees about the source address of data;
 (explicit failure rather than implicit failure).
-Move SPI to the build() method of IpSecTransform

Bug: 71717213
Test: runtest frameworks-net, CTS - IpSecManagerTest
Change-Id: I0824b37f443f4b8c62536d9801238c63ed8f2a1c
2018-01-16 11:08:31 -08:00
Lorenzo Colitti
b073a4beb6 Merge changes I0d0c0fac,Ifb9b00b6 am: b29d74c625 am: bfaf963337
am: aa9180b43f

Change-Id: I919f21566d5caff9fb35f57c439048b9b48f0971
2018-01-16 18:59:02 +00:00
Treehugger Robot
b29d74c625 Merge changes I0d0c0fac,Ifb9b00b6
* changes:
  Split updateCapabilities into two methods.
  More strictly check NetworkCapabilities callbacks.
2018-01-16 14:25:13 +00:00
Lorenzo Colitti
3bd4e209b9 Merge "Update netId to nethandle mapping in NetworkTest." am: 42293ba74d am: 503135596b
am: dd7216316d

Change-Id: I6feaa589fc43ff8ee1635be0fbd58aaa25679a5a
2018-01-16 13:46:46 +00:00
Treehugger Robot
42293ba74d Merge "Update netId to nethandle mapping in NetworkTest." 2018-01-16 12:23:02 +00:00
Hugo Benichi
548498fd1c Merge "MacAddress: add @NonNull annotations" am: 7d767a4710 am: a7c125e5b2
am: b2cf723e43

Change-Id: Ib525e2429609ce12c2be5bbeacffa217b65bebe3
2018-01-16 10:40:56 +00:00
Lorenzo Colitti
9499a55b90 Update netId to nethandle mapping in NetworkTest.
Bug: 63052780
Test: NetworkTest now passes
Change-Id: I5f1cb3055b7042a19afb5dd62f082912157612ba
2018-01-16 17:19:04 +09:00
Hugo Benichi
5e5c4b40f9 MacAddress: add @NonNull annotations
This patch adds to the MacAddress class:
  - getAddressType() method which replaces addressType(), for naming
  consistency
  - @NonNull annotations on all input and output reference values for
  all public methods (@hide and public).

TYPE_UNKNOWN, which currently cannot be observed with a non @hide
method, is also removed from the public api.

Bug: 71866627
Test: $ runtest frameworks-net
Change-Id: I2af70408d46f431b7b32183e6b48ddae9a261a2c
2018-01-16 13:32:59 +09:00
Lorenzo Colitti
23f3676c79 More strictly check NetworkCapabilities callbacks.
This change more strictly accounts for onCapabilitiesChanged
callbaks and their values. It exposes several cases where we the
callbacks we send are spurious.

Test: ConnectivityServiceTest continues to pass
Change-Id: Ifb9b00b6f0cae48f8ed41a525100d1744b5f429b
2018-01-16 00:25:13 +09:00
Erik Kline
16509a73d6 Merge changes I47ccfa99,I5db1de3e am: 3e2ccb4ff1 am: 03f3294103
am: c4bfb71ab9

Change-Id: Ic774b944238d6df07511df8e467d66cefcd4fa81
2018-01-11 12:52:19 +00:00
Erik Kline
cca88b079c Extract DNS setting logic into DnsManager class
In future, managing DNS-over-TLS hostname lookup and netd programming
can be encapsulated here.

Test: as follows
    - built
    - flashed
    - booted
    - runtest frameworks-net passes
Bug: 64133961
Change-Id: I47ccfa99c30c780524c45c4af605e720ccba34a0
2018-01-11 18:16:50 +09:00
Erik Kline
3fce4e528d Add minimal test for setting DNS properties
Test: as follows
Change-Id: I5db1de3ee8e179edd56c93988b821242b81c2387
2018-01-11 18:16:20 +09:00
Lorenzo Colitti
09fdb083b9 Merge "Move more core networking tests to framework/base/tests/net." am: 7571202ce2 am: 8f852c341f
am: a033382c50

Change-Id: I1eb98a82426d7b7e085316f8a67cdd1e81912538
2018-01-11 04:17:51 +00:00
Lorenzo Colitti
7571202ce2 Merge "Move more core networking tests to framework/base/tests/net." 2018-01-11 03:09:40 +00:00
Lorenzo Colitti
640bec275d Move more core networking tests to framework/base/tests/net.
Test: "runtest frameworks-net" passes except for already-failing IpConnectivityMetricsTest
Change-Id: I2a20d546089699ac67bc819f10a8fcd50c637ac4
2018-01-10 23:35:16 +09:00
Benedict Wong
3064d7cfe0 Merge "Add validation to IpSecConfig algorithm setters" am: a954f20f46 am: c93df5ca1c
am: 96b8f818af

Change-Id: I7ff85771945c68025ce8d66ca85313bac087b3a5
2018-01-09 21:23:35 +00:00
Benedict Wong
48db30d4c7 Add validation to IpSecConfig algorithm setters
Adds checks to ensure that users can only set the correct types of
algorithms for the Authentication, Encryption and Authenticated
Encryption algorithms.

Bug: 65223935
Test: Added tests in IpSecConfigTest, and passed on aosp_marlin-eng
Change-Id: I462c77d9eb5710b8d03a48866453649d3b6fc6bf
2018-01-04 16:56:40 -08:00
Hugo Benichi
9aa103913b MacAddress: address api review comments
1) toSafeString() is renamed to toOuiString()
2) toOuiString() returns a String that only contains the first 3 bytes
   of the mac address.

Bug: 70336442
Test: runtest frameworks-net
Change-Id: I798d8fec32dbff5687a682028e5d90eb941f81c1
Merged-In: I798d8fec32dbff5687a682028e5d90eb941f81c1

(cherry pick from commit b41f870464)
2017-12-21 08:34:05 +09:00
Benedict Wong
e6714a3685 Merge "[ipsec-doze] Add fchown to IpSecService to support doze" am: 4edb4c8ec4 am: 5949912523
am: 1281a3629a

Change-Id: Id6a5ff71ead4566b9a91b9e9b6c78d81f1ac0f54
2017-12-20 18:58:30 +00:00
Benedict Wong
590c47f6dd Merge "[ipsec-qtaguid] Tag sockets upon creation of encap sockets" am: 12045eafe6 am: 8caa274ade
am: 46a6429f68

Change-Id: I4140f386687c579044f9b5fe59dd7e05f86000fe
2017-12-19 00:41:55 +00:00
Benedict Wong
3e4e37a38b [ipsec-doze] Add fchown to IpSecService to support doze
Encap sockets are currently created as the system server, and should be
fchown'd to the user for whom it was created on behalf of.

Bug: 62994731
Test: New tests added and run to IpSecService
Change-Id: Icc49e709ae588981e69765fdb77537d7ffbac5fe
2017-12-18 16:01:58 -08:00
Benedict Wong
12045eafe6 Merge "[ipsec-qtaguid] Tag sockets upon creation of encap sockets" 2017-12-18 23:50:52 +00:00
Benedict Wong
768c332e51 [ipsec-qtaguid] Tag sockets upon creation of encap sockets
Added calls to tag encap sockets to that of the UID for which the encap
socket is being created on behalf of. This ensures that all data
accounting generated for the UDP-encap-ESP socket is correctly billed to
the right UID.

Bug: 62994731
Test: New tests added to IpSecServiceTest.java, passing
Change-Id: I15365ea9c982fd7b4e3cdeff314ddfba2289c86e
2017-12-18 19:46:06 +00:00
Hugo Benichi
b41f870464 MacAddress: address api review comments
1) toSafeString() is renamed to toOuiString()
2) toOuiString() returns a String that only contains the first 3 bytes
   of the mac address.

Bug: 70336442
Test: runtest frameworks-net
Change-Id: I798d8fec32dbff5687a682028e5d90eb941f81c1
2017-12-18 09:22:47 +09:00
Nathan Harold
4d3d0e096b Fix broken test due to API rename
A race condition during an Api rename has caused
the name change from reserveSecurityParameterIndex
to allocateSecurityParameterIndex to be wrong in
a test. Fixing.

Bug: 69128142
Test: runtest frameworks-net
Change-Id: I12fb9832cb938dc19f463b1f1124127435d7b173
2017-12-14 23:13:45 +00:00
Nathan Harold
55bd2e0e92 Fix broken test due to API rename
A race condition during an Api rename has caused
the name change from reserveSecurityParameterIndex
to allocateSecurityParameterIndex to be wrong in
a test. Fixing.

Bug: 69128142
Test: runtest frameworks-net
Change-Id: I12fb9832cb938dc19f463b1f1124127435d7b173
2017-12-14 23:04:42 +00:00
nharold
fc35e198fc Merge "Use consistent naming for allocating SPI." am: 624b2c1541 am: 4753ed4b1b
am: 4109d207eb

Change-Id: Ib6845ab0d7f385fbd1d59c0179771542e12c8be0
2017-12-14 21:48:58 +00:00
nharold
624b2c1541 Merge "Use consistent naming for allocating SPI." 2017-12-14 21:10:16 +00:00
Benedict Wong
0ffe141dd8 Merge "Convert IpSecService resources to use refcounting" am: 583a29abe6 am: 8698b33cc2
am: 6b129a012f

Change-Id: Ib18839d7dff8e25898f81e877337fbb8cb24cc7b
2017-12-14 02:41:28 +00:00
Benedict Wong
1cb5dabc65 Convert IpSecService resources to use refcounting
This is part 2 of 2 of the refcounting refactor for IpSecService
resources.

Switched ManagedResources to use RefcountedResource structure for
managing reference counts and eventual cleanup. Further, resource arrays
and quota management have been aggregated into a UserRecord for better
isolation. UID access checking has been similarly moved into the
UserRecordTracker, and resourceId checking has been rolled into
RefcountedResourceArray's accessor methods.

Bug: 63409385
Test: CTS, all unit tests run on aosp_marlin-eng, new tests added
Change-Id: Iee52dd1c9d2583bb6bfaf65be87569e9d50a5b63
2017-12-13 23:28:41 +00:00
Benedict Wong
d6a38397b0 Merge "Add reference counted resources to IpSecService" am: 42ae264bc8 am: adb6437fea
am: 24ddbe542c

Change-Id: Iae17a5d33d71e8abf24211cbf2b215520f45c619
2017-12-13 22:11:20 +00:00