Commit Graph

1125 Commits

Author SHA1 Message Date
Jeff Sharkey
ddd09dfbe7 Only emit debug logging when requested.
Test: builds, boots
Bug: 72556865
Change-Id: I69d5d760221ef907eeea38490f56243f0a3b9dcb
2018-02-20 13:36:23 -07:00
Jeff Sharkey
ce5665485f Merge "Leave NetworkStatsService around during shutdown." 2018-02-17 18:16:02 +00:00
Jeff Sharkey
a0626d7f40 Leave NetworkStatsService around during shutdown.
We've seen system code continue to ask about network statistics
during a shutdown, so keep our objects around to avoid crashing
with NPEs.

Test: builds, boots
Bug: 73323432
Change-Id: I2654d37a59eb830ff32a2151ae6ad6a999a41677
2018-02-16 16:28:27 -07:00
Jeff Sharkey
77bd2dfb9f Better handling of NTP-based clocks.
Now that we have a nice Clock abstraction, we can use it to represent
a clock backed by an NTP fix.  (This makes testing logic much easier
to write.)

We now rely completely on NetworkTimeUpdateService to keep our NTP
fix up to date, instead of trying to refresh in the middle of
critical paths which could trigger random ANRs.

Add internal FallbackClock to make it easier to handle missing NTP
fixes.  Add internal SimpleClock to let implementers focus on single
millis() method.

Test: bit FrameworksNetTests:com.android.server.net.NetworkStatsServiceTest
Test: bit FrameworksServicesTests:com.android.server.NetworkPolicyManagerServiceTest
Bug: 69714690, 72320957
Change-Id: Ic32cdcbe093d08b73b0e4b23d6910b23ea8e1968
Exempt-From-Owner-Approval: approved in previous PS
2018-02-16 22:11:35 +00:00
Benedict Wong
5e58ea8a2f Merge "Copy IpSecConfig when IpSecTransforms are created" am: 2c8456b22e am: 3988c929ad
am: 4aa9fef2fc

Change-Id: I511e6b0cadfc24f24a492ae63c48a8b4baa89edb
2018-02-15 06:01:49 +00:00
Benedict Wong
4aa9fef2fc Merge "Copy IpSecConfig when IpSecTransforms are created" am: 2c8456b22e
am: 3988c929ad

Change-Id: I041cd94be9cefc997b95478444661b557d95e3dc
2018-02-14 21:25:08 +00:00
Benedict Wong
e5623e2b61 Copy IpSecConfig when IpSecTransforms are created
This change prevents IpSecTransforms from being inadvertently modified
by changes to the IpSecConfig. Specifically, once the transform is
created, it takes a copy of the config, rather than a reference.

Bug: 69385347
Test: New tests added, and all test passing
Change-Id: I89b8660c175ca20aa70352dcda893434ff7fd42b
2018-02-13 23:23:13 +00:00
nharold
c40b5fb671 Merge "Require NETWORK_STACK Permission for IpSec Tunnel Mode" am: 43699e90f3 am: e736f83caf
am: 34c6697356

Change-Id: Ib33ccecfe2fc600c05a208d24df10a474addb0e5
2018-02-10 02:11:15 +00:00
nharold
34c6697356 Merge "Require NETWORK_STACK Permission for IpSec Tunnel Mode" am: 43699e90f3
am: e736f83caf

Change-Id: If7330b4fdf5d2ccbddb590ab81a4b19c1f612b66
2018-02-10 01:57:50 +00:00
TreeHugger Robot
5a89c8e36e Merge "Shore up dividing by zero protections." 2018-02-09 18:54:31 +00:00
Jeff Sharkey
1e80651d2a Shore up dividing by zero protections.
We're already trying to protect against zero elsewhere in this file,
but we've seen evidence of it still happening, so add last-ditch
protections.

Test: builds, boots
Bug: 73060623
Change-Id: I0549ed08f906521a8dbd9ff6162f80fa9b388434
2018-02-09 10:06:59 -07:00
Nathan Harold
025aae1fc9 Require NETWORK_STACK Permission for IpSec Tunnel Mode
At least until further permissions are agreed upon,
the NETWORK_STACK permission is sufficient to ensure
that access to the tunnel mode APIs is secure, and
this permission will always be a sufficient condition.
Thus, adding NETWORK_STACK.

Bug: 66955045
Test: compilation
Change-Id: I2dc36896a52d2e71fad55041507d68ca91191ffc
2018-02-08 21:16:51 +00:00
Andreas Gampe
49ccde2dfb Frameworks: Annotate trivial @GuardedBy in services/core
Add @GuardedBy for simple functions that require a single lock
and are named XYZLocked.

Derived by errorprone.

Bug: 73000847
Test: m
Test: m javac-check-framework RUN_ERROR_PRONE=true
Change-Id: I6993325b11c71a4ec27c21935fb54a954d95455f
2018-02-08 02:19:42 -08:00
Pavel Maltsev
f8505b7fae Merge "Enable multiple active Ethernet interfaces" am: cbcc1d6665 am: ac908d6728
am: f4c6c808a2

Change-Id: Ibd84c2ba3252e3d65ba4a63a0be912747ea18df9
2018-02-04 01:06:51 +00:00
Pavel Maltsev
f4c6c808a2 Merge "Enable multiple active Ethernet interfaces" am: cbcc1d6665
am: ac908d6728

Change-Id: I95a4e5d519857950297f5948525990c4808cd5fd
2018-02-03 01:25:34 +00:00
Treehugger Robot
cbcc1d6665 Merge "Enable multiple active Ethernet interfaces" 2018-02-02 23:13:54 +00:00
Chenbo Feng
c2a2f738ba Merge "Return non-negetive value in getMobileStats method" am: 9fb04e29e5 am: 515a54a93e
am: 4ae5e0c06c

Change-Id: I304f42d473289ad876f6ceae8d6866e4248686a9
2018-02-02 17:59:53 +00:00
Chenbo Feng
4ae5e0c06c Merge "Return non-negetive value in getMobileStats method" am: 9fb04e29e5
am: 515a54a93e

Change-Id: I54a400b4231c38db25aa1b717f302a8a52e1773e
2018-02-02 17:02:10 +00:00
Treehugger Robot
9fb04e29e5 Merge "Return non-negetive value in getMobileStats method" 2018-02-02 04:22:34 +00:00
Benedict Wong
04514d3e4b Merge "Fix minor bugs with tunnel mode implementation" am: cb9cd96c50 am: b7afa3f6fb
am: 25cb38a9b7

Change-Id: Ie74c4edcc7586e0220ff948222010e126841e8f7
2018-02-01 04:12:18 +00:00
Benedict Wong
25cb38a9b7 Merge "Fix minor bugs with tunnel mode implementation" am: cb9cd96c50
am: b7afa3f6fb

Change-Id: I9c2a844d9ccc401a34d0e6318506406e8c33fab6
2018-02-01 03:49:45 +00:00
Benedict Wong
7660370a83 Fix minor bugs with tunnel mode implementation
This change makes sure tunnel mode transforms are properly activated
upon construction, and corrects bugs with how policy selectors were being
generated for tunnel mode policies. Specifically, the source/destination could
not be empty strings, even for cases where an empty selector was desired.

Bug: 72457770
Test: GTS tests run
Change-Id: I9a9f64c34b07883a02a5c996614f958486d214fc
2018-01-31 01:16:53 +00:00
Chenbo Feng
905f034c57 Return non-negetive value in getMobileStats method
The current implementation of getMobileRxBytes and all the similiar
method adds up the return values for multiple calls to getRxBytes so if
all of them return UNSUPPORTED for any reason, getMobileRxBytes() would
return a value such as -3. This behavior is not compliance with the cts
TrafficStatsTest which always assume getMobileRxBytes to return a
non-negetive value. The method now will check tha stats get from
getRxBytes method and add them up only if the stats is valid.

Bug: 72473294
Test: run cts -m CtsNetTestCases -t android.net.cts.TrafficStatsTest
Change-Id: I656970ebc8f6506cf17c4353ad46c0178bb65cfd
2018-01-29 12:19:26 -08:00
Pavel Maltsev
50ec1f33c6 Enable multiple active Ethernet interfaces
- add Ethernet interface configurations to config.xml; no vendors can
specify network capabilities (in particular they can mark network as
restricted which make sense for embedded applications + static IP
configuration)
- extend EthernetManager to support multiple interfaces, use interface
name as an identificator
- extend IpConfigStore to store IP configuration based on string
identifier (e.g. ethernet name)

Test: runtest -x frameworks/base/services/tests/servicestests/ -c com.android.server.net.IpConfigStoreTest
Change-Id: Ic1e70003f2380ca8edb4469d6b34e27c5e8cf059
2018-01-29 10:11:05 -08:00
nharold
c20e9c8b4b Merge "Move Keepalive out of IpSecTransform.Builder" am: af3fb3efe4 am: bbb4b05a64
am: b9d614d4df

Change-Id: Ic554e34d9b16f522156bc7e8b176f96693e8e32c
2018-01-25 07:59:57 +00:00
nharold
b9d614d4df Merge "Move Keepalive out of IpSecTransform.Builder" am: af3fb3efe4
am: bbb4b05a64

Change-Id: I383aa402d9d570ee7c7d5a603d022d1dade267a5
2018-01-25 07:49:59 +00:00
Nathan Harold
b559164017 Move Keepalive out of IpSecTransform.Builder
The lifecycle of Keepalive offloading is, unfortunately
different from that of an IpSecTransform. Because starting
a keepalive is fundamentally asynchronous, and isn't valid
until after a transform exists, it will now be a separate
optional procedure that may succeed or fail. It remains
linked with a Transform by the need for a Transform to exist
in order to initiate a Keepalive.

Bug: 38350389
Test: compilation
Change-Id: Ia76fccee41f86d694dff436043293d0c0762c041
2018-01-24 19:32:04 -08:00
Benedict Wong
49f46b8e74 Merge "Add tunnel-mode calls to netd in IpSecService" am: 475fe28c50 am: 02d6d81006
am: 24dd1e9fb7

Change-Id: I998d44bac0993a8f2e9e228a0b0a80adfaa4d87e
2018-01-24 20:07:20 +00:00
Benedict Wong
24dd1e9fb7 Merge "Add tunnel-mode calls to netd in IpSecService" am: 475fe28c50
am: 02d6d81006

Change-Id: I8a3d16c8e58ad1c09d967943abe1c729fe37636a
2018-01-24 19:56:24 +00:00
Benedict Wong
45828d7122 Merge "Add TunnelInterface API and KernelResourceRecords" am: e02b700032 am: e1aa92f1c1
am: 5c3eb9ce8e

Change-Id: I955d5090171f08e4fa20eac5bdfe761132b87d35
2018-01-24 09:54:06 +00:00
Benedict Wong
f86780fa1f Merge "Add xfrm mark in IpSecConfig" am: 6b3456b253 am: 4077e802ad
am: fc2bcb4153

Change-Id: Ibaee9700cc6befdf6bbdb792cb673611e571d19a
2018-01-24 09:48:25 +00:00
Benedict Wong
5c3eb9ce8e Merge "Add TunnelInterface API and KernelResourceRecords" am: e02b700032
am: e1aa92f1c1

Change-Id: If27d78708ce225a900ad78a82d9f323770223808
2018-01-24 09:02:56 +00:00
Benedict Wong
8edc557ede Add tunnel-mode calls to netd in IpSecService
Adds calls to relevant netd methods in IpSecService, enabling Tunnel
mode functionality.

Bug: 63588681
Test: Compiles, passing CTS + unit tests
Change-Id: I6deb68584cddb03f21bd76370d4ef69cadc1bf16
2018-01-24 08:19:55 +00:00
Benedict Wong
fc2bcb4153 Merge "Add xfrm mark in IpSecConfig" am: 6b3456b253
am: 4077e802ad

Change-Id: I03ddca0611c4e0b41edc705cdb39b415205bb14b
2018-01-24 08:19:16 +00:00
Benedict Wong
e02b700032 Merge "Add TunnelInterface API and KernelResourceRecords" 2018-01-24 07:25:04 +00:00
Benedict Wong
8bc907311b Add TunnelInterface API and KernelResourceRecords
This change adds one KernelResourceRecord type (TunnelInterfaceRecord),
and adds methods for the creation of TunnelInterfaces, as well as the
application of Transforms to the given TunnelInterfaces

As part of the generation of ikeys/okeys, a ReserveKeyTracker manages a
java bitset to avoid collisions and reserve/release keys.

Bug: 63588681
Test: Compiles, CTS, unit tests all pass on AOSP_marlin
Change-Id: I9e9b6455e27073acd4491eae666aa966b3b10e0f
2018-01-24 07:24:27 +00:00
Benedict Wong
6b3456b253 Merge "Add xfrm mark in IpSecConfig" 2018-01-24 05:53:29 +00:00
Chenbo Feng
a94de8c9b5 Merge changes from topic "bpfStats" am: bd268b204c am: e041f38289
am: c10bd12062

Change-Id: I672efa1221e17d0962ca5702330fc83d75fcac81
2018-01-24 05:46:52 +00:00
Chenbo Feng
c10bd12062 Merge changes from topic "bpfStats" am: bd268b204c
am: e041f38289

Change-Id: Ib4790159fd331858ce9f3343a44ccec66fae638c
2018-01-24 05:39:54 +00:00
Treehugger Robot
bd268b204c Merge changes from topic "bpfStats"
* changes:
  Use /proc/net/dev to get stats summary
  Add bpf support for NetworkStatsFactory
  Add BPF support for NetworkStatsService
2018-01-24 04:08:29 +00:00
Benedict Wong
7ea128e242 Merge "Expose applyTunnelModeTransform as a system API" am: d056f32bd9 am: c2253ff48d
am: 82d8e1a25d

Change-Id: Ia1f81f5696814f5b9479882e1102a5f8508a4512
2018-01-24 02:58:17 +00:00
Benedict Wong
82d8e1a25d Merge "Expose applyTunnelModeTransform as a system API" am: d056f32bd9
am: c2253ff48d

Change-Id: I85c761df4b77dba0b62adfd3488f66cdcf780fa3
2018-01-24 02:50:47 +00:00
Benedict Wong
03e732a299 Expose applyTunnelModeTransform as a system API
Simple change to expose systemAPI for applyTunnelModeTransform

Bug: 36033193
Test: All CTS, unit tests passing
Change-Id: I2d857c048bc0dc80c3949387f946b1f5adf0527e
2018-01-23 23:25:54 +00:00
Benedict Wong
fd337e9e6a Merge "Add checks to ensure SPIs are not reused" am: 66aa524a04 am: 1a2e3f3b54
am: ac94b41c42

Change-Id: I13738ac37710ec7934998ef269681ae7c41c612e
2018-01-23 20:40:39 +00:00
Lorenzo Colitti
d3a884ac8d Merge changes from topic "multipath-datausage-backport" am: 1afa23dade am: c46c21c702
am: d1e9c2795c  -s ours

Change-Id: Ib16c50de2a3846dae9736e7ca68a4282831f0812
2018-01-23 20:20:53 +00:00
Lorenzo Colitti
6b13ceec95 Add metered, roaming, and defaultNetwork info to NetworkTemplate. am: 75ec1aed18 am: e383807d7f
am: cc323a7179  -s ours

Change-Id: I2710d5205e1d010f0b928acb7f76631a66d6349e
2018-01-23 20:16:55 +00:00
Lorenzo Colitti
c6aaed2a6e Add the defaultNetwork element to the netstats.proto. am: 0ba426b8a1 am: adcb94472a
am: aa2d703fd6  -s ours

Change-Id: Ife16614408062fb3a4a8954008a5d1aa63986edf
2018-01-23 20:06:47 +00:00
Lorenzo Colitti
359e76bb9f Add getDefaultNetwork to the NetworkStats public API. am: 92a946d09f am: 66eab17abc
am: 4ee6a6fb12  -s ours

Change-Id: I5df239d3da75332233b5043a163938d03f889881
2018-01-23 20:03:40 +00:00
Benedict Wong
ac94b41c42 Merge "Add checks to ensure SPIs are not reused" am: 66aa524a04
am: 1a2e3f3b54

Change-Id: I8c7243bc600e5f2e9abec03b5a357ed6376aa9bf
2018-01-23 19:55:47 +00:00
Lorenzo Colitti
d1e9c2795c Merge changes from topic "multipath-datausage-backport" am: 1afa23dade
am: c46c21c702

Change-Id: I45f0c69e3440e9ec69c82e81c41bea682a359389
2018-01-23 19:43:13 +00:00