Commit graph

4,339 commits

Message SHA1
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

Benedict Wong   commited 2018-01-24 07:24:27 +00:00
b8421d7772
Merge "Add xfrm mark in IpSecConfig"
Benedict Wong   authored and   Gerrit Code Review   commited 2018-01-24 05:53:29 +00:00
5bee154c8c
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.

Chalard Jean   authored and   Gerrit Code Review   commited 2018-01-24 04:09:44 +00:00
a890570df4
Merge changes from topic "bpfStats"
* changes:
  Use /proc/net/dev to get stats summary
  Add bpf support for NetworkStatsFactory
  Add BPF support for NetworkStatsService

Treehugger Robot   authored and   Gerrit Code Review   commited 2018-01-24 04:08:29 +00:00
8eb249c775
Merge "Add checks to ensure SPIs are not reused"
Benedict Wong   authored and   Gerrit Code Review   commited 2018-01-23 18:00:06 +00:00
1f232690c3
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.

Lorenzo Colitti   authored and   Gerrit Code Review   commited 2018-01-23 15:22:18 +00:00
61fe8317c7
Let network requests see VPNs.
Test: runtest frameworks-net
Test: also tested with VPN app
Test: also cts passing
Change-Id: I3b16caad7787c3c1f2921ca1583815c89efbadc5

Chalard Jean   commited 2018-01-23 21:38:00 +09:00
e3c1bfd61f
Move constants into a new file.
Also audit all constants, make some private, annotate some
with @VisibleForTesting.

Test: runtest framework && cts
Change-Id: Iaf5ea7abd36fd8d544dcc84654f6cb529196d654

Chalard Jean   commited 2018-01-23 21:38:00 +09:00
52e5af0742
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

Chalard Jean   commited 2018-01-23 21:38:00 +09:00
56ad8d8449
Add a test for new UID checking code.
Test: manual, this is a new test and it passes
Change-Id: I69a39039647ec05f970700e36c5f1e1e6e110f4a

Chalard Jean   commited 2018-01-23 21:38:00 +09:00
6b96118282
Remove UID_RANGES_ADDED and REMOVED.
Test: runtest frameworks-net
Test: also tested with VPN app
Test: also cts passing
Change-Id: I3530030996daeba05a8f2fffc5c6e21ed62e3f40

Chalard Jean   commited 2018-01-23 21:38:00 +09:00
a39c91c27c
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

Chalard Jean   commited 2018-01-23 21:38:00 +09:00
e4230ce692
Pre-import to remove a conflict.
Test: compiles and passes checkstyle
Change-Id: I1ffdd88e6268fee0cf88992420ab21eb42928957

Chalard Jean   commited 2018-01-23 21:38:00 +09:00
c97ac60ad0
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

Lorenzo Colitti   commited 2018-01-23 18:38:48 +09:00
ddf729bb8d
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

Chenbo Feng   commited 2018-01-23 00:35:02 -08:00
13d64cd653
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

Chenbo Feng   commited 2018-01-23 00:34:53 -08:00
0f3dfee39b
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

Benedict Wong   commited 2018-01-22 21:09:47 -08:00
bed828b632
Merge "Address comments and final cleanup from refcounting integration"
Benedict Wong   authored and   Gerrit Code Review   commited 2018-01-22 20:32:18 +00:00
f376b27a5c
Merge "Rename create/delete transform methods"
Benedict Wong   authored and   Gerrit Code Review   commited 2018-01-22 17:57:15 +00:00
5d164327e2
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

Benedict Wong   commited 2018-01-19 10:43:01 -08:00
a9d43af75e
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

Treehugger Robot   authored and   Gerrit Code Review   commited 2018-01-19 14:48:52 +00:00
76715955e0
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

Lorenzo Colitti   commited 2018-01-19 19:49:16 +09:00
e2e04f14d5
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

Lorenzo Colitti   commited 2018-01-19 19:49:16 +09:00
e9a6d36fb3
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

Lorenzo Colitti   commited 2018-01-19 16:40:10 +09:00
a9dcce5a67
Add xfrm mark in IpSecConfig
Bug: 63589600
Test: runtest frameworks-net
Change-Id: I2d38d781b8b31d8bf39fd4e9a7e31509f15a9e16

Di Lu   commited 2018-01-18 15:23:56 -08:00
ddac24c12b
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

Jeff Sharkey   commited 2018-01-18 14:46:13 -07:00
01ee403080
Merge "Add "not congested" network capability."
Jeff Sharkey   authored and   Gerrit Code Review   commited 2018-01-18 03:28:34 +00:00
f2ca25f0cb
Merge "Add basic resolution of Private DNS hostname"
Treehugger Robot   authored and   Gerrit Code Review   commited 2018-01-18 02:44:53 +00:00
90310d279e
Merge "Add public API methods for private DNS."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2018-01-18 01:17:17 +00:00
05b54efcb3
Add public API methods for private DNS.
Test: Small modifications to LinkProperties test.
Bug: 71828272
Change-Id: Id2f5acb5469132ec4a917837739f42085c71498e

dalyk   commited 2018-01-17 15:46:21 -05:00
83b5fa28ec
Address comments and final cleanup from refcounting integration
Added some extra comments on reference counting and moved a few methods
around. No significant logical changes made in this CL

Bug: 63409385
Test: CTS, Unit tests (both frameworks-base and netd) and binder tests
all pass

Change-Id: I89f1f4a021db48ae406fefefa6aca7406045736c

Benedict Wong   commited 2018-01-17 12:10:49 -08:00
370f737f19
Merge "IpSec - API Tweak for removeTransportModeTransform"
nharold   authored and   Gerrit Code Review   commited 2018-01-17 19:07:10 +00:00
dc88d02119
Add basic resolution of Private DNS hostname
Test: as follows
    - built
    - flashed
    - booted
Bug: 34953048
Bug: 64133961
Change-Id: I0a2289ea51a9294352c91d2ead23730d9b0333a5

Erik Kline   commited 2018-01-17 23:17:08 +09:00
c06d4f9be4
Add "not congested" network capability.
Can be used by a network to indicate when it's congested, meaning that
apps should defer network traffic that could be done at a later time.

Test: bit FrameworksNetTests:android.net.,com.android.server.net.,com.android.server.connectivity.VpnTest,com.android.server.ConnectivityServiceTest
Bug: 64133169
Change-Id: I8a60b6f02dd0f42268b59690556c16335d34e220

Jeff Sharkey   commited 2018-01-17 02:27:04 -07:00
d616b20c17
IpSec - API Tweak for removeTransportModeTransform
Because IpSecTransforms are now unidirectional,
and because the only mechanism for removing Transforms
removes it from both directions, the API can no longer
use the Transform parameter to meaningfully validate
that the caller had applied a transform. Since that
functionality was as-yet unimplemented and is now
infeasible, the transform parameter is removed.

Bug: 72079356
Test: cts - IpSecManagerTest; runtest frameworks-net
Change-Id: If19b0d34bdc6daf31a40d6d62bff326dcbca08c0

Nathan Harold   commited 2018-01-17 01:11:46 -08:00
2c97b2e3af
Merge changes from topic "ipsec-oneway-transform"
* changes:
  Update IpSecService UnitTests
  Make Transforms Unidirectional

nharold   authored and   Gerrit Code Review   commited 2018-01-17 08:40:37 +00:00
6987ca3620
Update IpSecService UnitTests
The IpSecService Unit tests relied on the
directionality of the IpSecConfig and previously
did not specify a source address. Unit tests
updated without functional change other than to
address these two requirements.

Bug: 71717213
Test: runtest frameworks-net
Change-Id: Iedbed735bc50fd4fdfe985f9e173956062a7b0d1

Nathan Harold   commited 2018-01-16 19:38:10 -08:00
e0d099dfb3
Make Transforms Unidirectional
Convert the IpSecTransform from being a bi-directional
pair of SAs to a unidirectional single SA. This CL
also removes the concept of "direction from SAs meaning
that a IpSecTransform may now be applied to a socket
in either direction.

-Make transforms unidirectional
-Add Convert allocateSpi() to use destination rather
 than direction and remote address
-Remove directionality from builders for IpSecTransform
-Change applyTransportModeTransform() to take a
 direction in which to apply the transform object.
-Additional minor naming updates
-Restrict IpSecConfig to only print keys on eng builds
-Move DIRECTION constants to IpSecManager
-Add sourceAddress parameter to IpSecTransform to provide
 additional guarantees about the source address of data;
 (explicit failure rather than implicit failure).
-Move SPI to the build() method of IpSecTransform

Bug: 71717213
Test: runtest frameworks-net, CTS - IpSecManagerTest
Change-Id: I0824b37f443f4b8c62536d9801238c63ed8f2a1c

Nathan Harold   commited 2018-01-16 11:08:31 -08:00
a47ac2bb32
Merge changes I0d0c0fac,Ifb9b00b6
* changes:
  Split updateCapabilities into two methods.
  More strictly check NetworkCapabilities callbacks.

Treehugger Robot   authored and   Gerrit Code Review   commited 2018-01-16 14:25:13 +00:00
b29d74c625
Split updateCapabilities into two methods.
This makes the code a bit easier to follow.

Test: ConnectivityServiceTest continues to pass
Change-Id: I0d0c0facc1e3ba07b53542b35da40ddc096ff92e

Lorenzo Colitti   commited 2018-01-16 21:25:10 +09:00
726641197d
Merge "Update netId to nethandle mapping in NetworkTest."
Treehugger Robot   authored and   Gerrit Code Review   commited 2018-01-16 12:23:02 +00:00
42293ba74d
Update netId to nethandle mapping in NetworkTest.
Bug: 63052780
Test: NetworkTest now passes
Change-Id: I5f1cb3055b7042a19afb5dd62f082912157612ba

Lorenzo Colitti   commited 2018-01-16 17:19:04 +09:00
9499a55b90
Merge "MacAddress: add @NonNull annotations"
Hugo Benichi   authored and   Gerrit Code Review   commited 2018-01-16 07:10:50 +00:00
7d767a4710
MacAddress: add @NonNull annotations
This patch adds to the MacAddress class:
  - getAddressType() method which replaces addressType(), for naming
  consistency
  - @NonNull annotations on all input and output reference values for
  all public methods (@hide and public).

TYPE_UNKNOWN, which currently cannot be observed with a non @hide
method, is also removed from the public api.

Bug: 71866627
Test: $ runtest frameworks-net
Change-Id: I2af70408d46f431b7b32183e6b48ddae9a261a2c

Hugo Benichi   commited 2018-01-16 13:32:59 +09:00
5e5c4b40f9
Merge "Change the netId to nethandle mapping."
Treehugger Robot   authored and   Gerrit Code Review   commited 2018-01-16 02:58:56 +00:00
333dc71728
Merge "ConnectivityService: synchronize access on mLockdownEnabled"
Hugo Benichi   authored and   Gerrit Code Review   commited 2018-01-16 00:20:52 +00:00
2a0316897e
Change the netId to nethandle mapping.
Being able to update this handle is necessary to ensure that
system-only OTAs do not break vendor code that relies on
nethandles.

Bug: 63052780
Test: walleye builds, boots, networking works
Test: MultinetworkApiTest CTS tests passes
Change-Id: I049a4ad2610ca68b8f56377b63be7e5e8ce76039

Lorenzo Colitti   commited 2018-01-16 02:08:09 +09:00
3d1632d6c9
More strictly check NetworkCapabilities callbacks.
This change more strictly accounts for onCapabilitiesChanged
callbaks and their values. It exposes several cases where we the
callbacks we send are spurious.

Test: ConnectivityServiceTest continues to pass
Change-Id: Ifb9b00b6f0cae48f8ed41a525100d1744b5f429b

Lorenzo Colitti   commited 2018-01-16 00:25:13 +09:00
23f3676c79
change NMS removeNetwork to netd binder variant
Also: require NETWORK_STACK instead of CONNECTIVITY_INTERNAL.

Bug: 34953048
Bug: 64133961
Test: as follows
    - built
    - flashed
    - booted
    - runtest frameworks-net
Change-Id: I26f07f51a8a2f4a8bb43a276da7c5e66c355c848

Erik Kline   commited 2018-01-15 19:51:37 +09:00
31645bd68e
Merge changes I47ccfa99,I5db1de3e
* changes:
  Extract DNS setting logic into DnsManager class
  Add minimal test for setting DNS properties

Treehugger Robot   authored and   Gerrit Code Review   commited 2018-01-11 11:33:30 +00:00
3e2ccb4ff1