Commit Graph

4362 Commits

Author SHA1 Message Date
Chalard Jean
ca1ca2c465 Merge "Fix a bug where a NetworkAgent gets repeatedly torn down"
am: f597b81b4e

Change-Id: Ic37c9f60448b10c861a78848bed18ebd4e0ad910
2018-01-25 07:33:35 +00:00
Chalard Jean
f597b81b4e Merge "Fix a bug where a NetworkAgent gets repeatedly torn down" 2018-01-25 05:37:21 +00:00
Chalard Jean
715d078639 Fix a bug where a NetworkAgent gets repeatedly torn down
mUids is not marshalled correctly when null so if the
NetworkAgent runs in another process and is not a VPN then
the system will see its allowed Uids as being the empty
list (= nobody can use this network) instead of a null
list (= everybody can use this network). This breaks
emulator networking.

Bug: 72436966
Test: runtests frameworks-net
Test: also manual testing, this does fix emulator networking
      and seems not to break phone networking
Change-Id: Id2bbf3808e80b19cd055c832c11cf72372710942
2018-01-25 04:51:44 +00:00
Benedict Wong
77189e8a86 Merge "Add tunnel-mode calls to netd in IpSecService"
am: 475fe28c50

Change-Id: I60bd2cd453b8ea7b5a0fb5eb0b59e8a9fe8f57cb
2018-01-24 19:48:26 +00:00
Benedict Wong
7cacbb3c86 Merge "Add TunnelInterface API and KernelResourceRecords"
am: 7a7d04e103

Change-Id: Ic8a93b2d6d8280c01808968251e6f422fa1d2340
2018-01-24 08:55:38 +00:00
Benedict Wong
859629fa0b 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
6829dd8442 Merge "Add xfrm mark in IpSecConfig"
am: da7f993d34

Change-Id: Idcac0878b4f74c25ef007fb7f1643fca5de80225
2018-01-24 08:00:52 +00:00
Benedict Wong
7a7d04e103 Merge "Add TunnelInterface API and KernelResourceRecords" 2018-01-24 07:25:04 +00:00
Benedict Wong
145b425fac 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
Chalard Jean
ee75f435b9 Merge changes I3b16caad,Iaf5ea7ab,I09a94042,I69a39039,I35300309, ...
am: 515b2e9434

Change-Id: I49269ac65138be59d68561ea1c15ff2ad0339d8b
2018-01-24 06:03:41 +00:00
Benedict Wong
da7f993d34 Merge "Add xfrm mark in IpSecConfig" 2018-01-24 05:53:29 +00:00
Chenbo Feng
a0b44c329f Merge changes from topic "bpfStats"
am: e339107631

Change-Id: I488be110cca66990f44f6e45d5489ce23f36432e
2018-01-24 05:32:34 +00:00
Chalard Jean
515b2e9434 Merge changes I3b16caad,Iaf5ea7ab,I09a94042,I69a39039,I35300309, ...
* changes:
  Let network requests see VPNs.
  Move constants into a new file.
  Make sure listen requests from VPN apps see their own networks
  Add a test for new UID checking code.
  Remove UID_RANGES_ADDED and REMOVED.
  Move VPN allowed UIDs into NetworkCapabilities.
  Pre-import to remove a conflict.
2018-01-24 04:09:44 +00:00
Treehugger Robot
e339107631 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
567ecd6790 Merge "Add checks to ensure SPIs are not reused"
am: e9f609ee76

Change-Id: I893925014557e5ae13303debc4ee8f50faf9605d
2018-01-23 19:27:51 +00:00
Lorenzo Colitti
50f296dec7 Merge changes from topic "multipath-datausage-backport"
am: ae0d925470

Change-Id: Ic29d71ade161434b6dea796a887f60b5587ca1d5
2018-01-23 19:17:54 +00:00
Lorenzo Colitti
71472bea68 Disable IpConnectivityMetricsTest.
am: c4ba57cadd

Change-Id: Iba9dad4001c6aa725285eee6df32f116c846532d
2018-01-23 19:04:05 +00:00
Benedict Wong
e9f609ee76 Merge "Add checks to ensure SPIs are not reused" 2018-01-23 18:00:06 +00:00
Lorenzo Colitti
ae0d925470 Merge changes from topic "multipath-datausage-backport"
* changes:
  Support passing a template to NetworkStatsManager queries.
  Add metered, roaming, and defaultNetwork info to NetworkTemplate.
  Unbreak frameworks-net tests broken by missing libutilscallstack.
  Disable IpConnectivityMetricsTest.
  Add the defaultNetwork element to the netstats.proto.
  Add getDefaultNetwork to the NetworkStats public API.
2018-01-23 15:22:18 +00:00
Chalard Jean
fd3a4ae0fe Let network requests see VPNs.
Test: runtest frameworks-net
Test: also tested with VPN app
Test: also cts passing
Change-Id: I3b16caad7787c3c1f2921ca1583815c89efbadc5
2018-01-23 21:38:00 +09:00
Chalard Jean
3a6b34c989 Move constants into a new file.
Also audit all constants, make some private, annotate some
with @VisibleForTesting.

Test: runtest framework && cts
Change-Id: Iaf5ea7abd36fd8d544dcc84654f6cb529196d654
2018-01-23 21:38:00 +09:00
Chalard Jean
b399bf16d1 Make sure listen requests from VPN apps see their own networks
Test: runtest frameworks-net
Test: CTS pass, including with the next patch which is what this
      actually matters for

Change-Id: I09a94042acbefa24ab884f95326e30d6ab280b82
2018-01-23 21:38:00 +09:00
Chalard Jean
92a116d264 Add a test for new UID checking code.
Test: manual, this is a new test and it passes
Change-Id: I69a39039647ec05f970700e36c5f1e1e6e110f4a
2018-01-23 21:38:00 +09:00
Chalard Jean
b2a4991781 Remove UID_RANGES_ADDED and REMOVED.
Test: runtest frameworks-net
Test: also tested with VPN app
Test: also cts passing
Change-Id: I3530030996daeba05a8f2fffc5c6e21ed62e3f40
2018-01-23 21:38:00 +09:00
Chalard Jean
753d9734d2 Move VPN allowed UIDs into NetworkCapabilities.
Test: runtest frameworks-net
Test: also new specific tests for this new code
Test: also tested with VPN app
Test: also cts passing
Change-Id: If0311bae2bf99dedac959febadecf4f92f3064b8
2018-01-23 21:38:00 +09:00
Chalard Jean
cbe99b35a0 Pre-import to remove a conflict.
Test: compiles and passes checkstyle
Change-Id: I1ffdd88e6268fee0cf88992420ab21eb42928957
2018-01-23 21:38:00 +09:00
Lorenzo Colitti
c4ba57cadd Disable IpConnectivityMetricsTest.
This test has been failing for a while, and we are do not have
bandwidth to fix it during the next week.

Test: make -j64 FrameworksNetTests RUN_ERROR_PRONE=true
Test: atest FrameworksNetTests:IpConnectivityMetricsTest
Test: runtest -x frameworks/base/tests/net/java/com/android/server/connectivity/IpConnectivityMetricsTest.java
Change-Id: I59d73c1773e160a726996f3ab4ad20312decc127
Merged-In: I59d73c1773e160a726996f3ab4ad20312decc127
2018-01-23 18:38:48 +09:00
Chenbo Feng
b25ada3657 Use /proc/net/dev to get stats summary
If the qtaguid proc file is no longer exist, the device is running new
eBPF module to do traffic accounting. So the NetworkStatsFactory need to
use the proc/net/dev interface to get the per interface traffic stats
summary. Also, adding a test to verify the helper function work properly

Bug: 30950746
Test: run NetworkStatsFactoryTest
Change-Id: Ia36808bf02f1637dd41a3e7c50917b91b1a77524
2018-01-23 00:35:02 -08:00
Chenbo Feng
7224ab835a Add bpf support for NetworkStatsFactory
Add the native method used to read the detail information of network
stats from bpf maps. The native method of NetworkStatsFactory should
choose the correct implementation to get the stats detail depending on
the kernel version. Currently the bpf result is printed as a reference
and the actual behavior of NetworkStatsFactory should not change.

Test: NetworkStatsFactory related cts test should not fail.
Bug: 30950746
Change-Id: I4715a23559b5b2306bd556cea0431f0ed172a993
2018-01-23 00:34:53 -08:00
Benedict Wong
bb31e20bcd Add checks to ensure SPIs are not reused
This change adds an additional check in CheckIpsecConfig to prevent
users from using the same SPI twice. This allows for a more granular
error message.

Bug: 70642141
Test: Tests added in IpSecServiceParameterizedTest
Change-Id: I9621fb05c6b162bd8ae8db4ac1e64feaa9d0ac73
2018-01-22 21:09:47 -08:00
Benedict Wong
9b1dfec3de Merge "Address comments and final cleanup from refcounting integration"
am: 3dcee3120b

Change-Id: Ie0bc2b81e09ee874ef848905bb486967a857c6d1
2018-01-22 23:57:28 +00:00
Benedict Wong
3dcee3120b Merge "Address comments and final cleanup from refcounting integration" 2018-01-22 20:32:18 +00:00
Benedict Wong
2af9354354 Merge "Rename create/delete transform methods"
am: 77883ceedc

Change-Id: I76576d1f3193fcbb3680fb29893cf696ea7a41fe
2018-01-22 19:44:43 +00:00
Benedict Wong
77883ceedc Merge "Rename create/delete transform methods" 2018-01-22 17:57:15 +00:00
Benedict Wong
01e9f19d7b Rename create/delete transform methods
CreateTransportModeTransform and DeleteTransportModeTransform are both
agnostic as far as which mode of transform it creates/deletes. As such,
to facilitate the implementation of tunnel mode, this patch renames them
to CreateTransform and DeleteTransform, along with all test names.

Bug: 63588681
Test: frameworks/base unit tests and CTS tests run, passed
Change-Id: I1f015eb7ad0e85fca966658a9402485ca2b44091
2018-01-19 10:43:01 -08:00
Lorenzo Colitti
69a42fa9c5 Merge changes Id8776d14,Ifa291c62,I5ea9d200
am: 5087f93c36

Change-Id: I7a0b01cba8bdee67cffabddacb4ff5f4591cbc34
2018-01-19 16:30:17 +00:00
Treehugger Robot
5087f93c36 Merge changes Id8776d14,Ifa291c62,I5ea9d200
* changes:
  Track and persist in stats whether traffic is on the default network.
  Add the default network to NetworkStats and NetworkStatsCollection.
  Pass all default networks to NetworkStatsService
2018-01-19 14:48:52 +00:00
Lorenzo Colitti
9d93e1a453 Track and persist in stats whether traffic is on the default network.
This change adds the defaultNetwork to the ident based on current
system networking state, and persists that value to flash.

Bug: 35142602
Test: runtest frameworks-net
Test: downloaded files using default/non-default networks while watching dumpsys netstats
Change-Id: Id8776d149b2977548a9eb455ad4926af55e25aba
2018-01-19 19:49:16 +09:00
Lorenzo Colitti
cd969ef97c Add the default network to NetworkStats and NetworkStatsCollection.
This allows us to maintain NetworkStats entries that track
whether the traffic was on the default network.

At the moment, the stats collection code always passes in
DEFAULT_NETWORK_NO. However, this value is a no-op, since it is
not persisted to disk. Only the ident, the uid/set/tag, and the
packet/byte/operation counters are persisted.

A future change will add defaultNetwork to the ident and start
persisting it.

Bug: 35142602
Test: runtest frameworks-net
Change-Id: Ifa291c62c0fa389b88e5561086a29dcd7cee2253
2018-01-19 19:49:16 +09:00
Lorenzo Colitti
2486188d7b Pass all default networks to NetworkStatsService
This will allow NetworkStatsService to treat traffic on these
networks differently from traffic where the app selects a network
that is not the default.

Bug: 35142602
Test: runtest frameworks-net
Change-Id: I5ea9d200d9fb153490c6108bb9390bf152f297da
2018-01-19 16:40:10 +09:00
Jeff Sharkey
d358b0d1ea Merge "Add ability to override subscriber capabilities."
am: d6cd4b241a

Change-Id: Id035d437e9b297ba70ba9231f6cfdd44e5b9c257
2018-01-19 01:04:32 +00:00
Di Lu
fcf78b1727 Add xfrm mark in IpSecConfig
Bug: 63589600
Test: runtest frameworks-net
Change-Id: I2d38d781b8b31d8bf39fd4e9a7e31509f15a9e16
2018-01-18 15:23:56 -08:00
Jeff Sharkey
0f2738ecb0 Add ability to override subscriber capabilities.
In a future set of CLs, NPMS will offer to override a handful of
capabilities on a per-subId basis.  Define a no-op version of the
interface to make it easier to add new methods in the future.

Test: bit FrameworksNetTests:android.net.,com.android.server.net.
Test: bit FrameworksTelephonyTests:com.android.internal.telephony.dataconnection.DataConnectionTest
Bug: 64133169
Change-Id: I03dfd98463861f0338c4174e8d8a88c300ea5b55
2018-01-18 14:46:13 -07:00
Jeff Sharkey
944a9864a2 Merge "Add "not congested" network capability."
am: 8a06cca651

Change-Id: I02ea25610df63b40547c3114c0f9a9ef59560e90
2018-01-18 03:58:13 +00:00
Erik Kline
5d10f67617 Merge "Add basic resolution of Private DNS hostname"
am: 5c2380b0d2

Change-Id: I9ce3476d80b05c140a02aaf1c21d4da2a68a8909
2018-01-18 03:54:50 +00:00
Jeff Sharkey
8a06cca651 Merge "Add "not congested" network capability." 2018-01-18 03:28:34 +00:00
Lorenzo Colitti
a57e5c074c Merge "Add public API methods for private DNS."
am: 6cba185910

Change-Id: If2bdfb05fcb235888bf272e4cfddb14619fc3f78
2018-01-18 03:21:02 +00:00
Treehugger Robot
5c2380b0d2 Merge "Add basic resolution of Private DNS hostname" 2018-01-18 02:44:53 +00:00
Lorenzo Colitti
6cba185910 Merge "Add public API methods for private DNS." 2018-01-18 01:17:17 +00:00
dalyk
7643abcbe3 Add public API methods for private DNS.
Test: Small modifications to LinkProperties test.
Bug: 71828272
Change-Id: Id2f5acb5469132ec4a917837739f42085c71498e
2018-01-17 15:46:21 -05:00