Commit Graph

1140 Commits

Author SHA1 Message Date
Nathan Harold
185f2ccd1c Hide IpSecManager, IpSecTransform, and IpSecAlgorithm
These classes, originally planned to be part of the
public API, are not ready for public consumption.
They are planned to be un-hidden in a future release.

Bug: 37681043
Test: make update-api and make
Change-Id: I8caccd3f8455341cb56a2256354eacbadedff047
2017-04-26 06:50:54 +00:00
Nathan Harold
7194bb9bf9 Hide IpSecManager, IpSecTransform, and IpSecAlgorithm
These classes, originally planned to be part of the
public API, are not ready for public consumption.
They are planned to be un-hidden in a future release.

Bug: 37681043
Test: make update-api and make
Merged-In: I8caccd3f8455341cb56a2256354eacbadedff047
Change-Id: I8caccd3f8455341cb56a2256354eacbadedff047
(cherry picked from commit e38565fc74ee19e27175782be3cf2f0dffefd3a6)
2017-04-25 16:53:50 -07:00
Hugo Benichi
803a2f073f NsdService: bootstrap unit tests
Test: new tests part of $ runtest frameworks-net
Bug: 37013369, 33298084
Change-Id: Ief45f838268380b4b2a128390fbf34d55a3b922b
2017-04-25 10:42:58 +09:00
Hugo Benichi
eb924c44ef Merge "NsdManager: add unit tests" am: dc54ad7fc3 am: 40ab8401b2 am: d2181235b9
am: 3b40687000

Change-Id: I86a9db7fe4f925162e1632152862c7b246230db9
2017-04-22 01:06:17 +00:00
Hugo Benichi
3b40687000 Merge "NsdManager: add unit tests" am: dc54ad7fc3 am: 40ab8401b2
am: d2181235b9

Change-Id: I7a5202be0e6a6274f3bd11737f30fee0ef947235
2017-04-22 00:57:48 +00:00
Hugo Benichi
0b1540e40d NsdManager: add unit tests
This prepares some refactoring and the addition of a timeout to
resolveService.

Test: new tests pass
Bug: 37013369, 33298084
Change-Id: Ie8277bd5983278507bfa70495b4ce7d13895b24b
2017-04-21 05:16:37 +00:00
Hugo Benichi
0ebf8234f9 Merge changes Ic029cc9f,Id917f3a2 into oc-dev am: 4a786f94c2 -s ours
am: 088a9c77d9  -s ours

Change-Id: I724372ba07b4f6008e0e9240d65842b3712f56d3
2017-04-20 16:06:27 +00:00
Hugo Benichi
088a9c77d9 Merge changes Ic029cc9f,Id917f3a2 into oc-dev
am: 4a786f94c2  -s ours

Change-Id: I2c62317b3a03edab06aa72d21e801d4355a85106
2017-04-20 04:34:48 +00:00
Hugo Benichi
4a786f94c2 Merge changes Ic029cc9f,Id917f3a2 into oc-dev
* changes:
  NsdService: minor cleanups
  Nsdmanager/NsdService: add logging
2017-04-20 04:27:50 +00:00
Hugo Benichi
5d4c5a2f5c NsdService: minor cleanups
Minor cleanups in switches of processMessage and handleNativeEvent.

Test: no functional changes
Bug: 33074219

(cherry picked from commit 23dba85fff01a9f51beea8ce811fc98b582f8e71)

Merged-In: I9ad4ce812c0d2c02a671a7a871ad427e4ce29b4a
Change-Id: Ic029cc9fa007d8c485f64f4afcbd4dc10da1ae29
2017-04-20 01:36:30 +00:00
Nathan Harold
d8ab7b0e63 Merge "Hide Socket+DatagramSocket IpSecTransform methods" into oc-dev am: fca728da6c
am: ef10a18ac4

Change-Id: I0be0f0930226a99bdc6d0fc3403836a329cda5be
2017-04-19 01:06:23 +00:00
Nathan Harold
ef10a18ac4 Merge "Hide Socket+DatagramSocket IpSecTransform methods" into oc-dev
am: fca728da6c

Change-Id: I64e9e5076b26562f3faaad8fb1a201d0933e8f50
2017-04-19 00:58:26 +00:00
Nathan Harold
2465e40b7d Merge "Consistenly Throw IOExceptions from IpSecManager" into oc-dev am: 01307a7e94 -s ours
am: ce1cec4741

Change-Id: I6c70846cb8b8dbe80aacce8cd9aa80e61a406acb
2017-04-19 00:56:49 +00:00
Nathan Harold
ce1cec4741 Merge "Consistenly Throw IOExceptions from IpSecManager" into oc-dev
am: 01307a7e94  -s ours

Change-Id: Id6b155b29ef23961b4c3303a2f35d1701c9f8478
2017-04-19 00:52:35 +00:00
nharold
85dee22023 Merge changes from topic 'ipsec-hide-overloads' am: fe358c6adf am: 8508bc52d2 am: 6eab2ee093
am: d19fe145b9

Change-Id: I8e88fe65b649e92e900c343862207bfd6089003d
2017-04-18 22:24:54 +00:00
Nathan Harold
4bba309fc0 Consistenly Throw IOExceptions from IpSecManager am: a64b019f94 am: 5db180bbb7 am: 7883c5d460
am: 31af88727b

Change-Id: If303276e7bd6a12a981492043a3d5e9a422d20b8
2017-04-18 22:23:52 +00:00
nharold
d19fe145b9 Merge changes from topic 'ipsec-hide-overloads' am: fe358c6adf am: 8508bc52d2
am: 6eab2ee093

Change-Id: Iaa713ba4b20bab12331bd996288ed2440c349db2
2017-04-18 22:12:54 +00:00
Nathan Harold
31af88727b Consistenly Throw IOExceptions from IpSecManager am: a64b019f94 am: 5db180bbb7
am: 7883c5d460

Change-Id: I04198299d43da4c9c91f705acc5520f734ad9249
2017-04-18 22:11:18 +00:00
Nathan Harold
b2b85df5d6 Hide Socket+DatagramSocket IpSecTransform methods
These methods do not currently work for IPv4 sockets,
so they need to be hidden until the underlying kernel
code can be made to work properly in a dual-stack
environment.

Bug: 36073210
Test: compilation
Merged-In: Idce367f638a42da374a7f1dc5ebb8931c9555e06
Change-Id: Idce367f638a42da374a7f1dc5ebb8931c9555e06
(cherry picked from commit da18b028f85e9a2c969c636aea6abf7f4bac3922)
2017-04-17 20:23:51 -07:00
Nathan Harold
2528c66a66 Consistenly Throw IOExceptions from IpSecManager
Bug: 36073210
Test: api-update
Change-Id: Ia3825e85b09b6330f1326a26cf9e1cadf9dacf71
Merged-In: Ia3825e85b09b6330f1326a26cf9e1cadf9dacf71
(cherry picked from commit c2fd6cfdc9dce33d57a3c2780e0527dd4b1bfeb9)
2017-04-17 20:23:34 -07:00
Nathan Harold
4b909c85f6 Hide Socket+DatagramSocket IpSecTransform methods
These methods do not currently work for IPv4 sockets,
so they need to be hidden until the underlying kernel
code can be made to work properly in a dual-stack
environment.

Bug: 36073210
Test: compilation
Change-Id: Idce367f638a42da374a7f1dc5ebb8931c9555e06
2017-04-17 19:41:08 -07:00
Nathan Harold
a64b019f94 Consistenly Throw IOExceptions from IpSecManager
Bug: 36073210
Test: api-update
Change-Id: Ia3825e85b09b6330f1326a26cf9e1cadf9dacf71
2017-04-17 17:57:41 -07:00
Hugo Benichi
b6389543d4 Nsdmanager/NsdService: add logging
This patch adds basic logging to NsdManager and NsdService, and improves
the facilities for pretty printing the event ids defined in NsdManager.

It also includes a few minor cleanups:
  - adding 'final' on effectively final instance variables of NsdManager
  and NsdService.
  - similarly, adding 'static' on effectively static class fields.
  - regrouping instance variables together.

Test: no functional changes
Bug: 33074219

(cherry picked from commit 2183ba9b5f8eb54c74cd198a7506b21319794e99)

Merged-In: I360d539e73cc8e4b45d4e0d20b2e345455fdb10c
Change-Id: Id917f3a2085d17f277850af36a2cf859e3614a0f
2017-04-17 10:07:05 +09:00
Nathan Harold
2d2ea79c1e Merge changes from topic 'ipsec-api-tweaks-merge' into oc-dev am: 9361283073
am: 7bb6ef2659

Change-Id: Ib34939764f9f347ad245c3497d36ed61c093e8eb
2017-04-14 20:35:47 +00:00
Nathan Harold
7bb6ef2659 Merge changes from topic 'ipsec-api-tweaks-merge' into oc-dev
am: 9361283073

Change-Id: I4ca6b6293dabe856098dda98ce6ca804fa419b44
2017-04-14 20:28:56 +00:00
Nathan Harold
0bb49fc68c Add FileDescriptor Versions of applyTransportModeTransform()
Because there is no way using the Java sockets API to actually
get a socket of AF_INET on mode machines, it is necessary to
provide a way to apply transforms to sockets made using the
native wrapper API, which uses POSIX APIs and will create a
socket that is AF_INET.

Bug: 36073210
Test: b/34811227
Change-Id: I28ac7cc4f36045ce523a54111e5be975b0331356
2017-04-13 15:05:13 -07:00
Nathan Harold
ed0fcf1faf IpSecManager and IpSecAlgorithm API Tweaks
-Add a reserveSecurityParamterIndex() function that allows the
 system to select an SPI.
-Disallow INVALID_SECURITY_PARAMETER_INDEX from being passed as
 an explicit SPI request.
-Remove the ALGO_ prefix from constants in IpSecAlgorithm

Bug: 36073210
Test: Updated CTS tests still pass on bullhead
Change-Id: Ic94809996076b0718f153f550b82192fe7048a2e
2017-04-13 15:04:47 -07:00
nharold
1e0d3fc657 Merge changes from topic 'am-e2002a7381854865a514803d2de26232' into oc-dev-plus-aosp
am: 9a5d047750

Change-Id: I986d031a47a578fda9f61b58e401e7ff53e24bc3
2017-04-12 21:43:27 +00:00
nharold
acdb1a217c Merge changes from topic 'ipsec-api-tweaks' am: fddf677b8b am: 176bfb58c6
am: a237a34085

Change-Id: Ie868985d20535f35b869730a4ddaa00dc88a352d
2017-04-12 20:53:17 +00:00
Nathan Harold
480aa304dd IpSecManager and IpSecAlgorithm API Tweaks am: 0540679eb4 am: 9c2428ad4d
am: 99c50add4f

Change-Id: I49641308cd0f2ce3e8a7545c8b03108d69287c64
2017-04-12 20:51:41 +00:00
Jack Yu
a49541d1c2 Merge changes into oc-dev-plus-aosp
am: a0afe2b4de

Change-Id: I53c193b28df6446580191ad6887768b80dfdd91c
2017-04-11 19:36:41 +00:00
Android Build Merger (Role)
a0afe2b4de Merge changes into oc-dev-plus-aosp 2017-04-11 19:22:17 +00:00
Nathan Harold
0072e19c8e Add FileDescriptor Versions of applyTransportModeTransform()
Because there is no way using the Java sockets API to actually
get a socket of AF_INET on mode machines, it is necessary to
provide a way to apply transforms to sockets made using the
native wrapper API, which uses POSIX APIs and will create a
socket that is AF_INET.

Bug: 36073210
Test: b/34811227
Change-Id: I28ac7cc4f36045ce523a54111e5be975b0331356
2017-04-11 10:14:11 -07:00
Nathan Harold
0540679eb4 IpSecManager and IpSecAlgorithm API Tweaks
-Add a reserveSecurityParamterIndex() function that allows the
 system to select an SPI.
-Disallow INVALID_SECURITY_PARAMETER_INDEX from being passed as
 an explicit SPI request.
-Remove the ALGO_ prefix from constants in IpSecAlgorithm

Bug: 36073210
Test: Updated CTS tests still pass on bullhead
Change-Id: Ic94809996076b0718f153f550b82192fe7048a2e
2017-04-11 10:14:10 -07:00
Hugo Benichi
28a4a50aad Merge changes I9ad4ce81,I360d539e am: f34d09ac30 am: 4062ac81be am: 84c878ecc8
am: 0a336978a8

Change-Id: I08ea5982d1f8f4d74bb37ad2409a1b7443bbb001
2017-04-06 02:57:00 +00:00
Nathan Harold
7c1acc7a6a Merge changes from topic 'ipsec-svc-pick' into oc-dev am: b077f6abd3 -s ours
am: d6b0f6e9f1

Change-Id: I9ed84510fdd92128bcd0a08b1dd90448e0ae09c1
2017-04-06 02:50:52 +00:00
Hugo Benichi
0a336978a8 Merge changes I9ad4ce81,I360d539e am: f34d09ac30 am: 4062ac81be
am: 84c878ecc8

Change-Id: Ieeb3222246c63292a75ad91e9c867eaedcad8f90
2017-04-06 02:13:07 +00:00
Nathan Harold
d6b0f6e9f1 Merge changes from topic 'ipsec-svc-pick' into oc-dev
am: b077f6abd3  -s ours

Change-Id: Iea4a23356643415390322a53a547f7194bb2cafa
2017-04-06 01:56:16 +00:00
Treehugger Robot
f34d09ac30 Merge changes I9ad4ce81,I360d539e
* changes:
  NsdService: minor cleanups
  Nsdmanager/NsdService: add logging
2017-04-06 01:51:36 +00:00
Nathan Harold
7c30d6b8f2 Add Initial IPsec APIs to IpSecService
-Plumb IpSecManager APIs to NetD
-Add Resource Management to IpSecService

Bug: 30984788
Test: b/34812052, b/34811227
Change-Id: Ic43965c6158f28cac53810adbf5cf50d2c54f920
(cherry picked from commit 93962f34ce21f5aac825afbcebf2f3e8c7a30910)
2017-04-05 10:24:45 -07:00
Nathan Harold
8e518b4255 IpSecManager and IpSecTransform API Cleanup
-Remove Int-based SPI usage from the IpSecTransform.Builder
 This is essentially a less-safe method overload, and it is both
 unnecessary and difficult to implement: the cross-validation
 between SPI and Transform is actually useful, and the kernel
 requires two different mechanisms to use an unreserved vs a
 reserved (alloc'd) SPI: CREATESA vs UPDATESA, which makes this
 hard to support. API Council has questioned the value of this,
 and they are right: everything points to "remove this". In the
 future, if we find that SPI reservation is overhead, we can
 always add it back.

-Hiding the TunnelMode builder method and application/remove
 methods. These will not land by the time the next API
 stabilizes, so better to hide them now that this is a
 near-certainty. Expectation is to un-hide them in the subsequent
 API bump.

Bug: 36073210
Test: Compilation, verified nobody is calling these stubs
Change-Id: Ic1a3f2cf7128633318ac175d6b56b45eb8d21cab
(cherry picked from commit 48b566557d5a66d4476008b3c59b815eb78cb373)
2017-04-05 10:24:23 -07:00
Nathan Harold
18fd608286 Change reserveSecurityParameterIndex() to take a remoteAddress
To make the SPI reservation more semantically consistent with the
transform creation API, and to ensure that we always create SPI
reservations relative to a well-known remote, we should take the
SPI request relative to a remote (rather than to a destination).
This necessitates that we now consider direction separately, which
is used for keying the SA-Id.

Bug: 36073210
Test: compilation
Change-Id: I81e955c20128c1f8e04fd68eb26669561f827a78
(cherry picked from commit c4f879925b58b1b5ca9a3cfdc898c20cbf56355a)
2017-04-05 10:24:03 -07:00
Nathan Harold
8ea66052f2 Add a Skeleton IpSecService
-Add IpSecService with the necessary glue to connect to netd
-Add code to retrieve IpSecService from System Server

Bug: 30984788
Test: b/34812052, b/34811227
Change-Id: I4cdcb643421141202f77a0e2f87a37012de0cd92
(cherry picked from commit 28084d89ec136b56f5012be33a0dea147962f9f6)
2017-04-05 10:23:27 -07:00
Hugo Benichi
f0c840913d NsdService: minor cleanups
Minor cleanups in switches of processMessage and handleNativeEvent.

Test: no functional changes
Bug: 33074219
Change-Id: I9ad4ce812c0d2c02a671a7a871ad427e4ce29b4a
2017-04-05 15:05:49 +09:00
Hugo Benichi
32be63d083 Nsdmanager/NsdService: add logging
This patch adds basic logging to NsdManager and NsdService, and improves
the facilities for pretty printing the event ids defined in NsdManager.

It also includes a few minor cleanups:
  - adding 'final' on effectively final instance variables of NsdManager
  and NsdService.
  - similarly, adding 'static' on effectively static class fields.
  - regrouping instance variables together.

Test: no functional changes
Bug: 33074219
Change-Id: I360d539e73cc8e4b45d4e0d20b2e345455fdb10c
2017-04-05 15:05:44 +09:00
Jeff Sharkey
9037a1de1e Consistent dump() permission checking. am: f1077c3095
am: ad0842183c

Change-Id: Iffbf78a7b48cea41ed4b0763f2452738e084225c
2017-04-03 06:26:04 +00:00
Jeff Sharkey
ad0842183c Consistent dump() permission checking.
am: f1077c3095

Change-Id: I300f8bc07e1266b9e78f56d085cd458862176a85
2017-04-03 06:19:02 +00:00
Jeff Sharkey
f1077c3095 Consistent dump() permission checking.
This change introduces new methods on DumpUtils that can check if the
caller has DUMP and/or PACKAGE_USAGE_STATS access.  It then moves all
existing dump() methods to use these checks so that we emit
consistent error messages.

Test: cts-tradefed run commandAndExit cts-dev -m CtsSecurityTestCases -t android.security.cts.ServicePermissionsTest
Bug: 32806790
Change-Id: Iaff6b9506818ee082b1e169c89ebe1001b3bfeca
2017-04-02 22:29:07 -06:00
nharold
f859d7e2a2 Merge changes from topic 'ipsec-transport-impl' am: 464dc5c07e am: 38e47af3ef am: 8108bef16d
am: 6ca64c9dbe

Change-Id: I4fdc0e7f211f637b00ec9ecd438a7a528aec001f
2017-04-02 00:44:13 +00:00
Nathan Harold
9c765a6866 IpSecManager and IpSecTransform API Cleanup am: 55e8910aa8 am: 91b516e78b am: 37f260f5d8
am: 426d6f088f

Change-Id: I3ab5922127950cc6bca042d6ab43fb10a5b83431
2017-04-02 00:43:05 +00:00