Commit Graph

417 Commits

Author SHA1 Message Date
Hugo Benichi
cc1f4b9dba Merge "MacAddress: add @NonNull annotations" am: bc3edde9c6 am: a7c125e5b2
am: e1c0b97447

Change-Id: Ib525e2429609ce12c2be5bbeacffa217b65bebe3
2018-01-16 10:40:56 +00:00
Hugo Benichi
8f21758d4a 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
Erik Kline
292453458a Merge changes I47ccfa99,I5db1de3e am: f98f97fe92 am: 03f3294103
am: 420d020689

Change-Id: Ic774b944238d6df07511df8e467d66cefcd4fa81
2018-01-11 12:52:19 +00:00
Erik Kline
3212008036 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
6e0347d6df Add minimal test for setting DNS properties
Test: as follows
Change-Id: I5db1de3ee8e179edd56c93988b821242b81c2387
2018-01-11 18:16:20 +09:00
Lorenzo Colitti
389812c768 Merge "Move more core networking tests to framework/base/tests/net." am: d207b1faa3 am: 8f852c341f
am: 291e7c4fce

Change-Id: I1eb98a82426d7b7e085316f8a67cdd1e81912538
2018-01-11 04:17:51 +00:00
Lorenzo Colitti
d207b1faa3 Merge "Move more core networking tests to framework/base/tests/net." 2018-01-11 03:09:40 +00:00
Lorenzo Colitti
a4fdc1204e 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
d49e808b8e Merge "Add validation to IpSecConfig algorithm setters" am: a954f20f46 am: c93df5ca1c
am: f85202f016

Change-Id: I7ff85771945c68025ce8d66ca85313bac087b3a5
2018-01-09 21:23:35 +00:00
Benedict Wong
a708eec031 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
1f3ce3f31a 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 3f83b8ad4e)
2017-12-21 08:34:05 +09:00
Benedict Wong
08faba25e6 Merge "[ipsec-doze] Add fchown to IpSecService to support doze" am: 4edb4c8ec4 am: 5949912523
am: a7d1b22d6d

Change-Id: Id6a5ff71ead4566b9a91b9e9b6c78d81f1ac0f54
2017-12-20 18:58:30 +00:00
Benedict Wong
6b42407013 Merge "[ipsec-qtaguid] Tag sockets upon creation of encap sockets" am: 0b8bf40ae4 am: 8caa274ade
am: b72b41b121

Change-Id: I4140f386687c579044f9b5fe59dd7e05f86000fe
2017-12-19 00:41:55 +00:00
Benedict Wong
42e3fa137d [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
0b8bf40ae4 Merge "[ipsec-qtaguid] Tag sockets upon creation of encap sockets" 2017-12-18 23:50:52 +00:00
Benedict Wong
c41067d51a [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
3f83b8ad4e 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
e5768f496f 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
bcbe3b6bf2 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
2079139e73 Merge "Use consistent naming for allocating SPI." am: 37303d5e94 am: 4753ed4b1b
am: b6bca5a59d

Change-Id: Ib6845ab0d7f385fbd1d59c0179771542e12c8be0
2017-12-14 21:48:58 +00:00
nharold
37303d5e94 Merge "Use consistent naming for allocating SPI." 2017-12-14 21:10:16 +00:00
Benedict Wong
882e5ed408 Merge "Convert IpSecService resources to use refcounting" am: a87a442c5a am: 8698b33cc2
am: 393a328478

Change-Id: Ib18839d7dff8e25898f81e877337fbb8cb24cc7b
2017-12-14 02:41:28 +00:00
Benedict Wong
d21105064e 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
9802ad3701 Merge "Add reference counted resources to IpSecService" am: 05013f3965 am: adb6437fea
am: 5dd409e76b

Change-Id: Iae17a5d33d71e8abf24211cbf2b215520f45c619
2017-12-13 22:11:20 +00:00
Benedict Wong
05013f3965 Merge "Add reference counted resources to IpSecService" 2017-12-13 21:33:38 +00:00
Benedict Wong
11c8f27e22 Add reference counted resources to IpSecService
This patch adds (but does not enable the usage of) RefcountedResource
objects to IpSecService, with tests to ensure correct function. This is
patch 1 of a series of patches to refactor the resource management
systems in IpSecService.

RefcountedResource objects allow for management of acyclical dependency
trees, ensuring eventual cleanup when resources are no longer used. This
cleanup may be triggered by binder death or by explicit user action.

Bug: 63409385
Test: New tests written in IpSecServiceRefcountedResourceTest,
explicitly testing the RefcountedResource class

Change-Id: Ib5be7482b2ef5f1c8dec9be68f15e90d8b3aba6d
2017-12-12 23:40:52 -08:00
Jonathan Basseri
fbe3a82340 Use consistent naming for allocating SPI.
Throughout the IPsec code (API, system server, netd) we use "reserve"
SPI and "allocate" SPI interchangeably. This renames to use "allocate"
everywhere for self-consistency and consistency with the kernel
(ALLOCSPI).

In javadoc, I am leaving the word "reserve" in several places because it
is still an accurate description of how the method behaves.

Bug: 69128142
Test: TreeHugger should be enough
Change-Id: I8ea603b4612303b0393beef04032671fa53d2106
2017-12-12 13:50:35 -08:00
ludi
cc00bd5639 Merge "Cleanup of resource limit tests" am: 7d0a38956e am: dc7693b146
am: 5b77df1729

Change-Id: If26dc3a8a969ad63f250608427480996c3b02845
2017-12-06 04:08:23 +00:00
ludi
dc7693b146 Merge "Cleanup of resource limit tests"
am: 7d0a38956e

Change-Id: Ifcbc61ad8003c43ba1baff6d4d534192f6498206
2017-12-06 03:29:35 +00:00
Treehugger Robot
7d0a38956e Merge "Cleanup of resource limit tests" 2017-12-06 02:58:41 +00:00
Hugo Benichi
e06a0a395e Merge "Fix bug in MacAddress.fromString()" am: cdb84d2fc7 am: a31109c229
am: 23649344d2

Change-Id: I7df23a45618825b874658ccbbf1d1fda6b164954
2017-12-05 10:09:35 +00:00
Hugo Benichi
a31109c229 Merge "Fix bug in MacAddress.fromString()"
am: cdb84d2fc7

Change-Id: If4c85f0a5ea259f53f9cffa6eacb58fcde1fd1df
2017-12-05 09:47:50 +00:00
Hugo Benichi
21c7a52042 Fix bug in MacAddress.fromString()
Test: runtest frameworks-net
Bug: 69390696
Change-Id: I83f01e4915092e08ed201d9b6738bb02498d3bba
2017-12-05 13:14:08 +09:00
nharold
abbb6d7923 Merge "Validate IpSecAlgorithm Length" am: 98ecd7efb2 am: 2a20e7a677
am: 96af5bbd36

Change-Id: I1a28d860ac7125afc1f82ac17d1834b0121c0e11
2017-12-05 02:46:06 +00:00
nharold
2a20e7a677 Merge "Validate IpSecAlgorithm Length"
am: 98ecd7efb2

Change-Id: I23f7612c119e67f9a1647568aeefde38a365f8da
2017-12-05 02:28:10 +00:00
nharold
98ecd7efb2 Merge "Validate IpSecAlgorithm Length" 2017-12-05 02:13:55 +00:00
Hugo Benichi
41dd9c894c Merge "MacAddress: light refactors and improve documentation" am: d871cab32d am: 56eeb80dc5
am: 6600538c55

Change-Id: Iae0e87bcc9bd9c1ba98319f3b65f18f6743c02a0
2017-12-05 00:06:50 +00:00
Hugo Benichi
56eeb80dc5 Merge "MacAddress: light refactors and improve documentation"
am: d871cab32d

Change-Id: I51bb8786ecd7f53e3342625c7a2625007eedfc0f
2017-12-04 23:38:27 +00:00
Nathan Harold
82c3470df9 Validate IpSecAlgorithm Length
Improve the Validation of IpSecAlgorithm by
explicitly checking the length in addition to
the truncation length (previously an oversight).
In addition, we now check the lengths during
un-parceling, which will catch someone maliciously
manually building a parcel and passing it, bypassing
the checks in the constructor.

Bug: 68780091
Test: runtest -x IpSecAlgorithmTest.java
Change-Id: I8172762617264d34f47d5144336464510f07a701
2017-12-04 15:12:14 -08:00
Hugo Benichi
5bc3546cf6 MacAddress: light refactors and improve documentation
This patch does some light refactoring in MacAddress to prepare for
exposing MacAddress in the public api:
 - documention is improved
 - some method names are renamed
 - a toSafeString method is added
 - a padding bug in the conversion methods outputting strings for
   mac addresses is fixed

Bug: 69390696
Test: runtest frameworks-net
Change-Id: I399a97dabc2dfa8df9c5518c8b12484e43ca05c9
2017-12-04 22:34:43 +09:00
Sudheer Shanka
278d074254 Track some event history and include it in netpolicy dump.
Bug: 66921847
Test: manual
Change-Id: I0c473790f83076def807308fe44db9cb9365769e
2017-11-28 11:33:43 -08:00
ludi
de99e42cc8 Cleanup of resource limit tests
Test: runtest frameworks-net
Bug: 65688605
Change-Id: Ice3ff2624b83c833a99559485c1e782d36c54ae3
2017-11-28 10:21:18 -08:00
Di Lu
d874098ad3 Merge "Add test case for user quota management in IpSecService" am: baaa5670f5 am: 4288bb9e34
am: e8c8f6267d

Change-Id: I84e81e261c93d2199e4932431ee57b75496ea2d5
2017-11-15 20:39:53 +00:00
Di Lu
4288bb9e34 Merge "Add test case for user quota management in IpSecService"
am: baaa5670f5

Change-Id: Ib1887b2395f0b1391711a9df9bebe224b6be1643
2017-11-15 20:23:14 +00:00
Di Lu
baaa5670f5 Merge "Add test case for user quota management in IpSecService" 2017-11-15 20:12:38 +00:00
Xin Li
acae66beee Merge commit '98e12851336b7db16e583f9afac63ecc97465980' from
oc-mr1-dev-plus-aosp-without-vendor into stage-aosp-master.

Change-Id: Ia7b8da4a00d215160e4a4fa40f6044208d1297b7
Merged-In: I19846d2a3ee27aecbae2367a74ee49082eea154d
2017-11-14 12:31:11 -08:00
Hugo Benichi
919987e3d5 Merge "IP connectivity metrics: NetworkEvents have transports" am: a37e03886f am: f3ada43f6e
am: c90d3a0bbd

Change-Id: If452f742e50344e730f63b7329788b19d13280ec
2017-11-14 12:03:25 +00:00
Hugo Benichi
1920023b5f Merge "Add L2~L4 information to packet wakeup logs and metrics" am: 6ee20ca7d3 am: ab15f7fc64
am: 3f23c704ab

Change-Id: Ia0b300662d4758f31ca583c9cf05f9186b8331aa
2017-11-14 11:55:45 +00:00
Hugo Benichi
c90d3a0bbd Merge "IP connectivity metrics: NetworkEvents have transports" am: a37e03886f
am: f3ada43f6e

Change-Id: I8cd50ea805fe3e533c0fc21b220827155cb0d23b
2017-11-14 01:46:23 +00:00
Hugo Benichi
3f23c704ab Merge "Add L2~L4 information to packet wakeup logs and metrics" am: 6ee20ca7d3
am: ab15f7fc64

Change-Id: I9dba29b10c824d382b08b16313e49cc8c775f7eb
2017-11-14 01:40:06 +00:00