Commit Graph

476 Commits

Author SHA1 Message Date
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
ludi
296907da6a Add test case for user quota management in IpSecService
Test: runtest frameworks-net
Bug: 65688605
Change-Id: I3210c4920d0ac1d09fecb56c25e392e2bcba641f
2017-11-13 14:14:11 -08:00
Hugo Benichi
d5c11bbb65 IP connectivity metrics: NetworkEvents have transports
Also removes netId field from inside NetworkEvent and stop populating
the network_id field of the NetworkEvent field, deprecating it.

Bug: 34901696
Test: runtest frameworks-net,
      manually looking at $ adb shell dumpsys connmetrics

Change-Id: I2c36860f976898883714f72f4d18e06da250c6a6
2017-11-13 14:15:51 +09:00
Hugo Benichi
fcccb3a36d Add L2~L4 information to packet wakeup logs and metrics
Example of $ adb shell dumpsys connmetrics list:
...
WakeupStats(wlan0, 21851s, total: 85, root: 0, system: 4, apps: 63, non-apps: 0, no uid: 18, l2 unicast/multicast/broadcast: 85/0/0, ethertype 0x800: 23, ethertype 0x86dd: 62, ipNxtHdr 6: 74, ipNxtHdr 17: 1, ipproto 58: 10)
...
WakeupEvent(06:55:54.094, wlan0, -1, eth=0x800, dstHw=10:e:7e:26:3f:c1, ipNxtHdr=6, srcIp=216.58.200.110, dstIp=100.112.108.29, srcPort=443, dstPort=46878)
WakeupEvent(06:57:14.379, wlan0, -1, eth=0x86dd, dstHw=10:e:7e:26:3f:c1, ipNxtHdr=58, srcIp=ff02::1, dstIp=fe80::fa00:4:fd00:1)
WakeupEvent(06:57:52.786, wlan0, 1000, eth=0x800, dstHw=10:e:7e:26:3f:c1, ipNxtHdr=6, srcIp=172.217.27.67, dstIp=100.112.108.29, srcPort=80, dstPort=49360)
WakeupEvent(06:58:02.919, wlan0, 10004, eth=0x86dd, dstHw=10:e:7e:26:3f:c1, ipNxtHdr=6, srcIp=2401:fa00:4:fd00:a585:13d1:6a23:4fb4, dstIp=2404:6800:4006:809::200a, srcPort=443, dstPort=46197)
WakeupEvent(06:58:05.586, wlan0, 10004, eth=0x86dd, dstHw=10:e:7e:26:3f:c1, ipNxtHdr=6, srcIp=2401:fa00:4:fd00:a585:13d1:6a23:4fb4, dstIp=2404:6800:4006:803::200a, srcPort=443, dstPort=46096)

Bug: 66869042
Test: runtest frameworks-net
      + manual testing by monitoring $ dumpsys connmetrics list
Change-Id: I03215c0c9fb7feda3e6ceb1b916f61f4ffb15344
2017-11-12 18:51:28 +09:00
Hugo Benichi
7e1e0d1583 Merge "MacAddress follow-up: define the core of the class" am: 005a90b337 am: d39a50350a
am: ca102e61ce

Change-Id: Iaa55c54a46844428da0ddd9d0a5ee899c0aa1dfb
2017-11-09 12:55:56 +00:00
Hugo Benichi
ca102e61ce Merge "MacAddress follow-up: define the core of the class" am: 005a90b337
am: d39a50350a

Change-Id: I1063cbb5a468818f68ee5406e52b6cd74c85c4bf
2017-11-09 12:43:52 +00:00
Hugo Benichi
005a90b337 Merge "MacAddress follow-up: define the core of the class" 2017-11-09 12:22:17 +00:00
Hugo Benichi
d380d14c4d MacAddress follow-up: define the core of the class
Test: new unit test parts of $ runtest frameworks-net
Change-Id: I08c57d2d656802f7bdd7a93fde711a7e77247583
2017-11-09 16:36:45 +09:00
Benedict Wong
269470d5a0 Merge "Update documentation for AES-GCM-ESP keymat length" am: fcbbf2b939 am: 6491b03410
am: e7e7095303

Change-Id: Ia0e1538feea2ddb0982875c925705c3648e50c8a
2017-11-08 18:27:06 +00:00
Benedict Wong
e7e7095303 Merge "Update documentation for AES-GCM-ESP keymat length" am: fcbbf2b939
am: 6491b03410

Change-Id: I5e61a9c28dac49f2dca554ce2fdf755ab7be0dab
2017-11-08 18:12:25 +00:00
Benedict Wong
fcbbf2b939 Merge "Update documentation for AES-GCM-ESP keymat length" 2017-11-08 17:47:40 +00:00
Hugo Benichi
e75a60743d Merge "Define MacAddress class" am: 925349ac8f am: 37caaaa705
am: 491a93b5ac

Change-Id: I0e09e64bb2a6306c0422443038351fabf10e2d6e
2017-11-08 06:57:00 +00:00
Hugo Benichi
491a93b5ac Merge "Define MacAddress class" am: 925349ac8f
am: 37caaaa705

Change-Id: I377de35ab9ce9d8bf44bd90295a2a41fbea06d7a
2017-11-08 06:46:49 +00:00
Hugo Benichi
88ad29b907 Define MacAddress class
Test: new unit tests part of $ runtest frameworks-net
Change-Id: I5a6a868ff86e9bffdc551d4e2bb486b585525c30
2017-11-08 11:09:49 +09:00
Benedict Wong
720c1249bf Update documentation for AES-GCM-ESP keymat length
Added notes that keymat length must include 32 bits of salt.

Bug: 68672051
Test: Frameworks-net unit tests & IpSecManager CTS tests run
Change-Id: I0ae0c5be8a45b2374783b3bd1fa8bf930f15e687
2017-11-07 17:39:35 -08:00
Hugo Benichi
0dfa4b300e Merge "DefaultNetworkEvent metrics: rehaul" am: addecd1491 am: d025358166
am: 83e05af631

Change-Id: Ia5c19bfbdf9eea553f4517f312295c14c2f02046
2017-11-06 07:41:53 +00:00
Hugo Benichi
83e05af631 Merge "DefaultNetworkEvent metrics: rehaul" am: addecd1491
am: d025358166

Change-Id: If6bf966ba547a2ce50e17340e0374dd9b75b80d9
2017-11-06 07:31:39 +00:00
Hugo Benichi
addecd1491 Merge "DefaultNetworkEvent metrics: rehaul" 2017-11-06 07:09:49 +00:00
Hugo Benichi
f123c85f29 DefaultNetworkEvent metrics: rehaul
This patch changes instrumentation of default networks and default
network events:
- stop logging events for default network transitions,
  but instead consistently log one event per continuous segment
  when one given network was the default, including logging an
  event for when there is no default network.
- keep a separate rolling buffer of DefaultNetworkEvent for
  dumpsys and bug reports.

These changes allow to simplify post aggregation of default network
event metrics by removing any need to do time series processing.
Instead, metrics and counters can be implemented withouth any ambiguity
by following the recipe:

% of x = sum(duration | x = true) / sum (all durations)

where x can be various conditions such as:
- the default network was validated
- the default network was WiFi
- the default network was IPv6
- there was no default network
- ...

Most importantly, this new logging scheme allows to measure much more
reliably:
- the % of the time that a device had Internet, in the sense that the
default network was validated.
- the time transitions between default networks, keyed by previous and
new transports/link layer, which allows to derive wakelock durations
and wakelock power costs from default network switches.

This patch also simplifies the dumpsys interface of the connmetrics
service and reduces the commands to three:
- "flush" for metrics upload.
- "proto" for printing buffered event in text proto format.
- "list" for listing all events and statistics.

Bug: 34901696
Bug: 65700460
Test: runtest frameworks-net
Change-Id: I0521f1681a60cca07ac3bfd5741d64ce44de4cdd
2017-11-06 09:04:02 +09:00
Jeff Sharkey
92675a966e Merge "Define NOT_ROAMING network capability." am: 8f380ab29c am: 3fe1ae29cd
am: 47ad296f75

Change-Id: I04220ff55fc87dbf8d417a30f15a06a877b412d4
2017-11-03 23:18:45 +00:00
Jeff Sharkey
47ad296f75 Merge "Define NOT_ROAMING network capability." am: 8f380ab29c
am: 3fe1ae29cd

Change-Id: Ib511f7af82c80fd4e95f4da9de1fdce200deb987
2017-11-03 23:07:03 +00:00
Jeff Sharkey
07e19362de Define NOT_ROAMING network capability.
The "roaming" state of a network really belongs on NetworkCapabilities
instead of being published through NetworkInfo.isRoaming().  One major
reason is to support developers creating NetworkRequests for a
non-roaming network.

Watch for any capability changes that network statistics are
interested in (either metered or roaming) and notify it to perform
an update pass; fixes bug where we previously only triggered on
roaming changes.

Fix bug in VPNs where metered/roaming capabilities of underlying
networks weren't being propagated; this was probably preventing
some jobs from running over unmetered networks, and causing other
jobs to run over roaming networks!  Also passes along link bandwidth
information from underlying networks, and propegates any changes
to underlying networks.

Fix race condition by reading prevNc inside lock.  Utility methods
correctly calculate min/max link bandwidth values.

Test: bit FrameworksNetTests:android.net.,com.android.server.net.,com.android.server.connectivity.,com.android.server.ConnectivityServiceTest
Bug: 68397798, 16207332
Change-Id: I3e1a6544c902bf3a79356b72d3616af1fd2b0f49
2017-11-01 19:05:42 -06:00
Manoj Boopathi Raj
7b76b5f4ac Merge "Fixed NullPointerException in IpSecService-Netd binder layer" am: 626046b7f5 am: a096e8d177
am: 6e94f3f675

Change-Id: I8c51bfa708622dfb47ae55438f08b98f04c1d6c6
2017-10-27 18:21:48 +00:00
Manoj Boopathi Raj
6e94f3f675 Merge "Fixed NullPointerException in IpSecService-Netd binder layer" am: 626046b7f5
am: a096e8d177

Change-Id: I23ea94140ac3e34fc92fdc6a2c0d694396489e03
2017-10-27 18:06:09 +00:00
Manoj Boopathi Raj
626046b7f5 Merge "Fixed NullPointerException in IpSecService-Netd binder layer" 2017-10-27 17:32:56 +00:00
Manoj Boopathi Raj
03bb7d9304 Fixed NullPointerException in IpSecService-Netd binder layer
Replaced null with empty byte array in createTransportModeTransform
for null auth.getKey, crypt.getKey() and authCrypt.getKey()

Test: Ran CTS test
Bug: 68052730
Change-Id: I5110b1297b4bfbb5766e8ecfd3d64f8110b52945
2017-10-26 13:10:22 -07:00
Hugo Benichi
efc9cdb106 Merge changes I59b6e04f,I55694d89 am: bccc497249 am: 93134fea64
am: 2eca2c0e3a

Change-Id: I61f321ebd67432e02b5621fa1c662953295999fd
2017-10-26 06:34:27 +00:00
Hugo Benichi
2eca2c0e3a Merge changes I59b6e04f,I55694d89 am: bccc497249
am: 93134fea64

Change-Id: I923fe9cc37463e695182c7a279d201ba7e9d6518
2017-10-26 06:23:31 +00:00
Hugo Benichi
7e86f2e10f Remove Parcelable interface from DefaultNetworkEvent
This patch takes advantage of the direct DefaultNetworkMetrics interface
between ConnectivityService and IpConnectivityMetrics and removes the
Parcelable interface from DefaultNetworkEvent.

IpConnectivityMetrics, IpConnectivityEventBuilder and associated tests
are updated as necessary.

Bug: 34901696
Test: runtest frameworks-net
Change-Id: I59b6e04fc126051320d08a422cfbd4d27042123e
2017-10-25 12:40:13 +09:00
Hugo Benichi
cd8d58c405 Extract logging of default network events
This patch extracts the logging of DefaultNetworkEvent from inside
ConnectivityService and move it to a new DefaultNetworkMetrics class.

The DefaultNetworkMetrics is a singleton owned by the
IpConnectivityMetrics singleton implementing the metrics service for
core networking. ConnectivityService has access to this singleton via
LocalServices.

This class layout will allow to remove the Parcelable interface of
DefaultNetworkEvent and will instead let the IpConnectivityMetrics
service grab metrics from the DefaultNetworkMetrics directly.

Bug: 34901696
Test: runtest frameworks-net
Change-Id: I55694d89124272732aba114198776462372de18b
2017-10-25 12:36:29 +09:00
Benedict Wong
396f1030d3 Merge "Return a port from bindToPort() in IpSecService" am: 51de41dea2 am: 0d4a1ae642
am: a52b3a7775

Change-Id: I0d1c17c3740983ab0cbc24c2cd0d3a530b56ca99
2017-10-24 17:09:28 +00:00
Benedict Wong
a52b3a7775 Merge "Return a port from bindToPort() in IpSecService" am: 51de41dea2
am: 0d4a1ae642

Change-Id: Ie59d496a38bf9775c1f40a543a24cb3fec5719bf
2017-10-24 16:54:57 +00:00
Benedict Wong
51de41dea2 Merge "Return a port from bindToPort() in IpSecService" 2017-10-24 16:31:21 +00:00
Benedict Wong
ce0dababb2 Merge "Add support for AES-GCM-ESP as an IPSec algorithm" am: b6df7f0d35 am: f0d0bdc372 am: f92bfc3b77
am: 10a7405642

Change-Id: Ie9a43c7f0519a2d7ac3326944608190503804483
2017-10-19 17:48:53 +00:00
Benedict Wong
10a7405642 Merge "Add support for AES-GCM-ESP as an IPSec algorithm" am: b6df7f0d35 am: f0d0bdc372
am: f92bfc3b77

Change-Id: I49932a5fc048b4a60512fac45a3537f050397168
2017-10-19 17:37:22 +00:00
Benedict Wong
212777930f Return a port from bindToPort() in IpSecService
When binding to a random port, the port number was not being
returned, so the user is incorrectly receiving a port of zero.
Return the port number that was ultimately bound.

Bug: 67662580
Test: Ran CTS test on aosp_angler-eng
Change-Id: I22f4e5cdc83d43dc453788889990feb34e451bd3
2017-10-18 11:43:43 -07:00
Benedict Wong
edc1d285d7 Add support for AES-GCM-ESP as an IPSec algorithm
Allows native AES-GCM-ESP to be used as an IPSec transport/tunnel mode
algorithm with kernel support

Bug: 63589918
Test: IPsecService tests added, existing ones pass
Change-Id: Ie1a9a902be205f269aa37bf956198f2e5b177c21
2017-10-18 11:22:24 -07:00
Hugo Benichi
d551adff6d Merge "Fix ConnectivityServiceTest#testNetworkCallbackMaximum" am: f7929f37b9 am: a5ea707a44 am: 4071792cce
am: fa684574da

Change-Id: I65c210d8f0ee27540339233d45def0c464920aea
2017-10-15 03:39:01 +00:00
Hugo Benichi
fa684574da Merge "Fix ConnectivityServiceTest#testNetworkCallbackMaximum" am: f7929f37b9 am: a5ea707a44
am: 4071792cce

Change-Id: Id5ee94ae9a7e2a92289f2b25b0d5c0f0b5b7381a
2017-10-15 02:53:58 +00:00
TreeHugger Robot
3d0712af87 Merge "Migrating remaining core networking tests to Junit4" 2017-10-13 05:26:31 +00:00
Hugo Benichi
739e2eacac Migrating remaining core networking tests to Junit4
Bug: 62918393
Test: runtest frameworks-net
Change-Id: I30f7eaa0307b8fad5a8de7a0da235a4f76c18677
2017-10-13 12:16:32 +09:00
Hugo Benichi
602996fe25 Fix ConnectivityServiceTest#testNetworkCallbackMaximum
Although commit 2a84d1cbcf fixed some flakyness issues in
testNetworkCallbackMaximum so that it became stable when ran on its own,
it introduced a new source of random failures because instead of
registering callbacks after callbacks until a limit was reached, commit
2a84d1cbcf changed the test logic to push the assertions right up to
the theoretical limit.

More precisely when registering and unregistering PendingIntents in a
loop, not introducing some delay for checking that previous
PendingIntents have been effectively unregistered can cause the test to
fail. This patch fixes this issue.

Bug: 32561414
Bug: 62918393
Test: runtest frameworks-net
      testNetworkCallbackMaximum now succeeds 100 in a row on sailfish

Change-Id: I086817a738ab99fd53ba76ca8faada6151f46472
2017-10-12 23:15:14 +09:00