Commit Graph

699 Commits

Author SHA1 Message Date
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
Treehugger Robot
f34d09ac30 Merge changes I9ad4ce81,I360d539e
* changes:
  NsdService: minor cleanups
  Nsdmanager/NsdService: add logging
2017-04-06 01:51:36 +00: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
nharold
38e47af3ef Merge changes from topic 'ipsec-transport-impl'
am: 464dc5c07e

Change-Id: I6caf23f5fef995f1ad735ea64b99660a5180799f
2017-04-02 00:19:44 +00:00
Nathan Harold
91b516e78b IpSecManager and IpSecTransform API Cleanup
am: 55e8910aa8

Change-Id: I1524f8381c8a73ba4dc7a36b343e11066b75c08d
2017-04-02 00:18:42 +00:00
Nathan Harold
031acb850f Add Initial IPsec APIs to IpSecService
-Plumb IpSecManager APIs to NetD
-Add Resource Management to IpSecService

Bug: 33695893
Test: CTS verifies nearly all of these paths
Change-Id: Ic43965c6158f28cac53810adbf5cf50d2c54f920
2017-03-31 18:11:27 -07:00
Nathan Harold
55e8910aa8 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
2017-03-31 11:21:10 -07:00
Nathan Harold
d083810c0b Merge "Change reserveSecurityParameterIndex() to take a remoteAddress"
am: d118826971

Change-Id: Ie59322c4e80aab89d784a2fcb3edd6458677bbb7
2017-03-30 03:39:46 +00:00
Nathan Harold
909d66e80a 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
2017-03-29 17:46:47 -07:00
Nathan Harold
caf765db81 Merge commit 'ce073d70bedc' into stage-aosp-master
Change-Id: I319034a5b77de5cf71de0e110bb17819fb907f1b
2017-03-29 16:04:31 -07:00
Nathan Harold
d2a1dad9a8 Add a Skeleton IpSecService
-Add IpSecService with the necessary glue to connect to netd
-Add code to retrieve IpSecService from System Server

Bug: 34811227
Test: Service boots (and dumpsys works), more via b/34811227
Merged-In: I4cdcb643421141202f77a0e2f87a37012de0cd92
Change-Id: I4cdcb643421141202f77a0e2f87a37012de0cd92
2017-03-29 11:31:27 -07:00
Ryuki Nakamura
8d2a076b4e Merge "Fix NPE while performing NetworkStatsService.removeUidsLocked()"
am: a6ce3f3021

Change-Id: I3f43b25622e5052e6336983da84b92e12f3e06dc
2017-03-20 17:05:16 +00:00
Ryuki Nakamura
662a01236a Fix NPE while performing NetworkStatsService.removeUidsLocked()
Symptom:
NPE occurred while performing NetworkStatsService.removeUidsLocked().

Root cause:
NetworkStatsService refers to mUidRecorder at
NetworkStatsService.removeUidsLocked() when mUserReceiver received
Intent.ACTION_USER_REMOVED.
However NetworkStatsService sets mUidRecorder to null without
unregistering mUserReceiver when mShutdownReceiver received
Intent.ACTION_SHUTDOWN.
Therefore NPE occurred when mUserReceiver received
Intent.ACTION_USER_REMOVED after mShutdownReceiver received
Intent.ACTION_SHUTDOWN.

Solution:
Unregister mUserReceiver before setting mUidRecorder to null when
mShutdownReceiver received Intent.ACTION_SHUTDOWN.

Bug: 36015339

Change-Id: I9279e4c6ae07d94e7ec519c40b2d973c84d8fef1
2017-03-07 07:12:51 +00:00
Nathan Harold
5466fbdc27 Merge "Add API Surface for creating IpSec Transforms"
am: 7645fa2816

Change-Id: Ibe70a60c5c5808a7877145cccefcc1f11bfacc51
2017-03-01 14:12:55 +00:00
Nathan Harold
b1f605fc33 Add API Surface for creating IpSec Transforms
This CL adds an API to set up an IPSec Security Association
and Security Policy to perform Transport-Mode and Tunnel-Mode encapuslation
of IP Packets.

Bug: 30984788
Bug: 34811752
Test: 34812052, 34811227
Change-Id: Ic9f63c7bb366302a24baa3e1b79020210910ac0a
2017-02-28 22:01:20 -08:00
Stephen Chen
30fb2f228b Merge commit '29a9cf2250e0eaed062fd0f990a04b923896279b' into nyc-mr1-dev-plus-aosp
am: 8aa88a533c

Change-Id: I3de8f91b1c9d0160ec58be8347502769580e0159
2017-01-27 07:29:07 +00:00
Hugo Benichi
d44a2395e3 Merge commit 'a19056c35d16ddb5a6c1d3343729701b8939f1e1' into nyc-mr1-dev-plus-aosp
am: cf7d2e1221  -s ours

Change-Id: Ie2f8c1e18acf57238fe4816812562ecd1644cf51
2017-01-27 07:28:06 +00:00
The Android Automerger
8aa88a533c Merge commit '29a9cf2250e0eaed062fd0f990a04b923896279b' into nyc-mr1-dev-plus-aosp
* commit '29a9cf2250e0eaed062fd0f990a04b923896279b':
  Implement metered tracking for NetworkStats summary queries.
2017-01-27 06:39:41 +00:00
The Android Automerger
cf7d2e1221 Merge commit 'a19056c35d16ddb5a6c1d3343729701b8939f1e1' into nyc-mr1-dev-plus-aosp
* commit 'a19056c35d16ddb5a6c1d3343729701b8939f1e1': (35 commits)
  NetworkMonitor: send one DNS probe per web probe
  NetworkMonitor metrics: add first validation information
  APF: also drop any ICMPv6 RSs
  ConnectivityServiceTest: fix testAvoidBadWifiSettings
  Fix ConnectivityServiceTest testRequestBenchmark
  Switch over to new "time.android.com" NTP pool.
  Define API for metering network stats buckets.
  Refactored NetworkStatsServiceTest to use Mockito instead of EasyMock.
  Use @Ignore to explicitly disable a @Test method.
  Fixed NetworkStatsServiceTest and converted it to JUnit4.
  VPN network stat accounting changes.
  ConnectivityThread: use lazy holder idiom
  ConnectivityManager: use ConnectivityThread looper
  ConnectivityManager: a simpler CallbackHandler
  Indicate the NsdServiceInfo attributes are only filled in for a resolved service.
  Add a null check for the OnStartTetheringCallback.
  TokenBucket for rate-limiting and throttling
  IpConnectivityMetrics reads buffer size in settings
  CaptivePortalLogin: set mixed content policy to compatibility.
  Add IP conn metrics to dumpsys and bug reports
  ...
2017-01-27 06:39:05 +00:00
Stephen Chen
29a9cf2250 Implement metered tracking for NetworkStats summary queries.
Dependent on ag/1550196 where API is defined.

Bug: 31015360
Bug: 26545374
Test: runtest --path
frameworks/base/core/tests/coretests/src/android/net/NetworkStatsTest.java,
other test classes.

(cherry picked from commit 357f8fabc8)

Change-Id: I46da93ba4afa968facf98f7c3d844fd0c469095a
2017-01-26 18:52:32 +09:00
Stephen Chen
a471b1647e Define API for metering network stats buckets.
This is a continuation of b/26545374, since now we can also set the
metered bit with NetworkScorer. The tracking of metered state changes
will be implemented in a seperate CL.

Bug: 31015360
Bug: 26545374
Test: N/A

(cherry picked from commit ed7fcb4d26)

Change-Id: I6a2fcc8577d62daa8823dff9e0128a5cf39ede7b
2017-01-26 18:52:08 +09:00
Jeremy Joslin
921f6f6797 VPN network stat accounting changes.
Properly account for VPN apps that make heavy use of the tun
interface. Prior to this change a VPN app could be incorrectly charged
for more data than it actually used if it sent more traffic through
the tun interface than the underlying interface.

This change excludes VPN app traffic on the tun interface from the
adjustment pool and doesn't redistribute traffic to the VPN app.
Instead all of the redistributed traffic is deducted from the VPN app
which effectively represents any overhead incurred by the VPN app.

BUG: 30557871

(cherry picked from commit 12255e3655)

Change-Id: I06f01aa8fe5fdc06b2d36cfb9c68feb244c2e5de
2017-01-26 18:51:53 +09:00
Stephen Chen
f57c4def50 DO NOT MERGE: Implement metered tracking for NetworkStats summary queries.
Dependent on ag/1550196 where API is defined.

Bug: 31015360
Bug: 26545374
Test: runtest --path
frameworks/base/core/tests/coretests/src/android/net/NetworkStatsTest.java,
other test classes.

(cherry picked from commit 357f8fabc8)

(cherry picked from commit 92b6175069)

Change-Id: I79e401fc4159264a075febba82bd8c295b8e677f
2017-01-18 19:08:41 +09:00
Stephen Chen
88b52b25f7 DO NOT MERGE: Define API for metering network stats buckets.
This is a continuation of b/26545374, since now we can also set the
metered bit with NetworkScorer. The tracking of metered state changes
will be implemented in a seperate CL.

Bug: 31015360
Bug: 26545374
Test: N/A

(cherry picked from commit ed7fcb4d26)

(cherry picked from commit ebace40092)

Change-Id: I01ebb270c5bf7f2383e8923cce72545ca1bee118
2017-01-18 19:08:32 +09:00
Philip P. Moltmann
8ad38f0f6c DO NOT MERGE: Indicate the NsdServiceInfo attributes are only filled in for a resolved service.
Fixes: 28530428

(cherry picked from commit 79a3c031a0)

(cherry picked from commit 2838d9bb56)

Change-Id: Ib8f8da947af804c8b203928e57ed6a8aedbf0684
2017-01-18 19:08:16 +09:00
Lorenzo Colitti
c1c6b379c4 Merge changes from topic 'framework-net-aosp' am: a79b99893c
am: 1a2fa0f372

Change-Id: I746ee7fd37946df2ba31ca8aee928fa3ef04591c
2016-12-09 10:18:11 +00:00
Stephen Chen
c8be8d5853 DO NOT MERGE: Implement metered tracking for NetworkStats summary queries. am: 92b6175069 -s ours
am: 3f5785260e  -s ours

Change-Id: Ib6f4a4af04c3f4e26028604c66f6cc4f1720a801
2016-12-09 10:04:41 +00:00
Stephen Chen
f394f5c66f DO NOT MERGE: Define API for metering network stats buckets. am: ebace40092 -s ours
am: 419a061017  -s ours

Change-Id: Ide68c11828a6473e330715bb4efe4d0ade9a46a2
2016-12-09 09:58:05 +00:00
Jeremy Joslin
0e885ddad1 DO NOT MERGE: VPN network stat accounting changes. am: b135f1d5a8 -s ours
am: 12bb3f057b  -s ours

Change-Id: Id9d26bf1b9512a85cd9b6a3253b86b77a6f62e77
2016-12-09 09:54:07 +00:00
Philip P. Moltmann
4ede7f4df7 DO NOT MERGE: Indicate the NsdServiceInfo attributes are only filled in for a resolved service. am: 2838d9bb56 -s ours
am: 6e8a33a583  -s ours

Change-Id: I95d1b3e8b676572dd3fb78aa750731e4c4c6a31f
2016-12-09 09:50:04 +00:00
Lorenzo Colitti
a79b99893c Merge changes from topic 'framework-net-aosp'
* changes:
  DO NOT MERGE: frameworks-test: adding missing @SmallTest
  DO NOT MERGE: Netd events: record connect() success/errno
  DO NOT MERGE: Add missing dependency.
  DO NOT MERGE: Show notification for always-on app VPN
  DO NOT MERGE: Implement metered tracking for NetworkStats summary queries.
  DO NOT MERGE: NetworkMonitor: send one DNS probe per web probe
  DO NOT MERGE: NetworkMonitor metrics: add first validation information
  DO NOT MERGE: APF: also drop any ICMPv6 RSs
  DO NOT MERGE: ConnectivityServiceTest: fix testAvoidBadWifiSettings
  DO NOT MERGE: Fix ConnectivityServiceTest testRequestBenchmark
  DO NOT MERGE: Switch over to new "time.android.com" NTP pool.
  DO NOT MERGE: Define API for metering network stats buckets.
  DO NOT MERGE: Refactored NetworkStatsServiceTest to use Mockito instead of EasyMock.
  DO NOT MERGE: Use @Ignore to explicitly disable a @Test method.
  DO NOT MERGE: Fixed NetworkStatsServiceTest and converted it to JUnit4.
  DO NOT MERGE: VPN network stat accounting changes.
  DO NOT MERGE: ConnectivityThread: use lazy holder idiom
  DO NOT MERGE: ConnectivityManager: use ConnectivityThread looper
  DO NOT MERGE: ConnectivityManager: a simpler CallbackHandler
  DO NOT MERGE: Indicate the NsdServiceInfo attributes are only filled in for a resolved service.
  DO NOT MERGE: Add a null check for the OnStartTetheringCallback.
2016-12-09 09:11:22 +00:00
Stephen Chen
92b6175069 DO NOT MERGE: Implement metered tracking for NetworkStats summary queries.
Dependent on ag/1550196 where API is defined.

Bug: 31015360
Bug: 26545374
Test: runtest --path
frameworks/base/core/tests/coretests/src/android/net/NetworkStatsTest.java,
other test classes.

(cherry picked from commit 357f8fabc8)

Change-Id: I46da93ba4afa968facf98f7c3d844fd0c469095a
2016-12-09 13:59:33 +09:00
Stephen Chen
ebace40092 DO NOT MERGE: Define API for metering network stats buckets.
This is a continuation of b/26545374, since now we can also set the
metered bit with NetworkScorer. The tracking of metered state changes
will be implemented in a seperate CL.

Bug: 31015360
Bug: 26545374
Test: N/A

(cherry picked from commit ed7fcb4d26)

Change-Id: I6a2fcc8577d62daa8823dff9e0128a5cf39ede7b
2016-12-09 13:59:17 +09:00
Jeremy Joslin
b135f1d5a8 DO NOT MERGE: VPN network stat accounting changes.
Properly account for VPN apps that make heavy use of the tun
interface. Prior to this change a VPN app could be incorrectly charged
for more data than it actually used if it sent more traffic through
the tun interface than the underlying interface.

This change excludes VPN app traffic on the tun interface from the
adjustment pool and doesn't redistribute traffic to the VPN app.
Instead all of the redistributed traffic is deducted from the VPN app
which effectively represents any overhead incurred by the VPN app.

BUG: 30557871

(cherry picked from commit 12255e3655)

Change-Id: I06f01aa8fe5fdc06b2d36cfb9c68feb244c2e5de
2016-12-09 13:42:29 +09:00
Philip P. Moltmann
2838d9bb56 DO NOT MERGE: Indicate the NsdServiceInfo attributes are only filled in for a resolved service.
Fixes: 28530428

(cherry picked from commit 79a3c031a0)

Change-Id: If2bfc06589adb361f11b89cd5923cb5c255cb680
2016-12-09 13:42:09 +09:00
Jeff Sharkey
8cbc5e3eac Merge "StrictMode to detect untagged network traffic." am: 0bb7880e77
am: bc9c6a91b9

Change-Id: Id6ce5cfedab250f25c0eb8b0c49971e9e20cbeb2
2016-11-21 21:48:31 +00:00
Jeff Sharkey
bc9c6a91b9 Merge "StrictMode to detect untagged network traffic."
am: 0bb7880e77

Change-Id: I52cdce87d87ec503294e431c8f22e87235bdbf79
2016-11-21 21:43:58 +00:00
Treehugger Robot
0bb7880e77 Merge "StrictMode to detect untagged network traffic." 2016-11-21 21:33:15 +00:00
Jeff Sharkey
66dca17fe7 StrictMode to detect untagged network traffic.
Define some constants for early use in AOSP code.

Test: builds, boots, all common traffic tagged
Bug: 30943431
Change-Id: Ia58a8933bccfddbc027afb78c63ae65bd71ce562
2016-11-21 12:15:16 -07:00
Sohani Rao
cc075c5823 Merge "Permissions check for Wifi Display configuration" am: f5c32a411c
am: 35b0d6e8a5

Change-Id: Iac379dace6fd8b01e5bb80a193f79c65ace1f9b9
2016-11-14 19:44:46 +00:00
Sohani Rao
35b0d6e8a5 Merge "Permissions check for Wifi Display configuration"
am: f5c32a411c

Change-Id: I7a1c2d0f48728cd5e056076a2cf1499a7abb2438
2016-11-14 19:33:31 +00:00
Sohani Rao
e2667a9df6 Permissions check for Wifi Display configuration
Wifi Display is configured using the AIDL call setMiracastMode()
and using a message over the async channel SET_WFD_INFO.
Enforce permissions on the calling uid before updating the config

Bug: 18668877
Test: Unit tests
Change-Id: I0be2d2af49070aad759f24bd31331f7df39a0422
Merged-In: I0be2d2af49070aad759f24bd31331f7df39a0422
2016-11-14 10:21:31 -08:00
Jeremy Joslin
e8c39cab9e VPN network stat accounting changes. am: 218bfe7a33
am: 0d309b7a47

Change-Id: I797ac586581f83ada0e94639dd435122c987f1c1
2016-10-21 23:43:06 +00:00
Jeremy Joslin
218bfe7a33 VPN network stat accounting changes.
Properly account for VPN apps that make heavy use of the tun
interface. Prior to this change a VPN app could be incorrectly charged
for more data than it actually used if it sent more traffic through
the tun interface than the underlying interface.

This change excludes VPN app traffic on the tun interface from the
adjustment pool and doesn't redistribute traffic to the VPN app.
Instead all of the redistributed traffic is deducted from the VPN app
which effectively represents any overhead incurred by the VPN app.

BUG: 30557871
Change-Id: I62a75a0c0c0111e052b7903baa9f5d6d94ef57fd
2016-10-21 18:47:57 +09:00
Mitchell Wills
3c46ac731a DO NOT MERGE Manually merge commit 'f28778064383821ccf48c9570191f34a24aa513f' into nyc-mr1-dev-plus-aosp
Change-Id: I7cb1f97a5b931c2057a811d7947f47ad7320ef1c
2016-08-29 17:46:44 -07:00
Roshan Pius
88e33a2864 IpConfigStore: Changes for parsing old wifi backup
Some changes in IpConfigStore to parse old backup data. The old backup
data contained a raw byte dump of the ipconfig.txt. So, make changes in
IpConfigStore to parse the inputstream from backup data into
IpConfiguration objects.

Changes in the CL:
1. Make the |readIpAndProxyConfigurations| method static so that
it can be used as a utility for parsing the backup data.
2. Create a new version of |readIpAndProxyConfigurations| method to
accept an input stream parameter.
3. Make |writeConfig| method static so that it can be used for
unit-testing the backup migration logic.

BUG: 29075035
Change-Id: Ic074952d9f9ef143089a371e6c527470cb1c229c
(cherry picked from commit ad683cadb2)
2016-08-26 13:22:45 -07:00
Jack Yu
05cca1a4cb Do not print misleading debug messages in some scenarios.
When the mobile network is not active, querying the network
information might trigger the misleading debug messages. Added
some condition checks to prevent this.

bug: 30850733
Change-Id: Ice6d548a56f98bac7fe2ca6a06148350b505533d
2016-08-23 16:09:36 -07:00
TreeHugger Robot
6ba04e354e Merge "Fix NativeDaemonConnectorException issue accessing null object" into nyc-mr1-dev 2016-06-30 00:20:51 +00:00