Commit graph android_packages_modules_Co.../tests/net/java/android
Message SHA1
Add the list of private DNS addresses to LinkProperties
(clean cherry-pick from ag/3874803)

Test: atest android.net.LinkPropertiesTest, also new tests pass
Bug: 73641539
Change-Id: If33a35b1354a67db09411ff098f20064797296ad
Merged-In: I4b739c56e658690532ae9deb0b9a3bc9b2adf8b0
Merged-In: I6bdbef78d078d68534c8e07e9af031ce374560ef

Chalard Jean   commited 2018-04-27 13:32:10 +09:00
299d856143
Force creation of Socket upon Transform application
This change forces Socket and DatagramSocket to populate the
SocketImpl, ensuring that the socket file descriptor can be
retrieved when applying Transport mode Transforms

This is done by calling getSoLinger(), triggering a getImpl(), which
triggers setImpl() if needed.

Bug: 77491294
Test: Added tests in IpSecManagerTest, ran on walleye
Change-Id: I40da08b031357710eb794e0f866aec5660c79594

Benedict Wong   commited 2018-04-03 17:04:55 -07:00
412ff4144b
Merge "Mark networks with OEM_PAID always restricted"
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2018-03-30 07:00:54 +00:00
dbc568ceaf
Mark networks with OEM_PAID always restricted
Bug: 68762530
Exempt-From-Owner-Approval: OWNERS have approved, but gerrit doesn't see it
Test: runtest -x frameworks/base/tests/net/ -c android.net.NetworkCapabilitiesTest
Change-Id: Ieadef7c42634d890281543226203530fb18eb0a3

Pavel Maltsev   authored and   Lorenzo Colitti   commited 2018-03-30 07:00:39 +00:00
8cb5245570
Merge "Require explicitly supplied truncation length"
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2018-03-30 04:59:22 +00:00
2db4d5fbda
Merge "Clarify UDP encapsulation socket API"
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2018-03-30 04:58:47 +00:00
db1e624ee1
Require explicitly supplied truncation length
Instead of providing default truncation lengths (based on RFC or
otherwise), this change imposes a restriction that the truncation length
must be supplied for all auth or aead algorithms.

Bug: 77204048
Test: Updated tests, ran on walleye
Change-Id: I4a0e2e71aa97259e56f44e7c8a2ce53135708d97

Benedict Wong   commited 2018-03-28 18:02:54 -07:00
5f38c02385
Fix network usage stats on 464xlat tethered.
Usage stats corrections for 464xlat in NetworkStatsFactory are not applied
to tethered traffic. Add adjustments in NetworkStatsService. After
migrating external callers off NetworkStatsFactory, we will be able to
only apply adjustments in NetworkStatsService and remove stacked
interface tracking from NetworkStatsFactory.
Bug: 72107146
Fixes: 72107146
Test: runtest frameworks-net & manual - checked corrected network usage

Change-Id: I5ce450e616b4fddf21f2a491fe5d0c9e9f969bda

Remi NGUYEN VAN   commited 2018-03-28 12:14:14 +09:00
c19a5eb8e4
Clarify UDP encapsulation socket API
This change updates the getSocket() methods for IPsec to improve clarity
of the return types, both for public APIs, and internal-only methods.

Bug: 72473753
Test: APIs updated, CTS + unit tests ran.
Change-Id: I0afebd432c5d04c47c93daa1ce616d712aa323d7

Benedict Wong   commited 2018-03-27 19:46:50 -07:00
a042c3f82b
Add method to NetworkStatsService for UID stats.
Useful for clients such as BatteryStats which currently rely
on NetworkStatsFactory. Data at that stage is incomplete as
it does not account for tethering, VT data and corresponding
464xlat corrections.

Test: runtest frameworks-net, CTS tests pass.
Change-Id: I763b77f601c827fd2963204694fb5b45425cc791

Remi NGUYEN VAN   commited 2018-03-22 15:31:28 +09:00
1cb92c713f
Merge "Added implementation for VTI add/remove address"
Benedict Wong   authored and   Gerrit Code Review   commited 2018-03-19 22:05:09 +00:00
3f3410ae6b
Added implementation for VTI add/remove address
This change adds implementation details for add/remove addresses onto a
VTI.

Bug: 73675031
Test: New tests added, passing on Walleye
Change-Id: Idde9d943a5285d2c13c5c6b0f7b8a9faf718e6a5

Benedict Wong   commited 2018-03-16 10:25:43 -07:00
0da1f39e22
Fixing comments in Network Capabilities
Clean up after aosp/606338

Test: m -j (only comments has been changed)
Change-Id: I2627654450244024c2be92f9067534dfc2a80891

Pavel Maltsev   commited 2018-03-09 10:42:32 -08:00
1f9f48e1c4
Merge "Minor clean-up in NetworkCapabilities"
Treehugger Robot   authored and   Gerrit Code Review   commited 2018-03-07 21:06:59 +00:00
1dd43b192c
Allow null subscriberId in NetworkStatsManager.
Use a MATCH_MOBILE_WILDCARD template to avoid filtering by
subscriberId when querying statistics from NetworkStatsService.

Bug: 74038898
Change-Id: I4b39e7031416cb33b23d89aa36ff0f774eaa942f
Fixes: 74038898
Test: runtest frameworks-net, CTS tests pass

Remi NGUYEN VAN   commited 2018-03-06 13:28:19 +09:00
a08eb7203b
Merge "Extend network request to query networks w/o capabilites"
Treehugger Robot   authored and   Gerrit Code Review   commited 2018-03-02 19:04:31 +00:00
47d4d15483
Merge "Give apps with NETWORK_SETTINGS right to see any VPN."
Chalard Jean   authored and   Gerrit Code Review   commited 2018-03-02 11:52:15 +00:00
faed85f2b0
Give apps with NETWORK_SETTINGS right to see any VPN.
...not only the ones that apply to them.

Bug: 73217368
Test: runtest frameworks-net and CTS
Change-Id: I436972a3e51e98bdd815771b451bcedadf684763

Chalard Jean   commited 2018-03-02 17:10:11 +09:00
9a396cc3c6
Give VPNs the INTERNET capability when they route most of the IP space
Test: manual, plus wrote some new tests for this
Bug: 72765718
Change-Id: I9759da72b752fd8eeb1d0647db9ab341f04c0528

Chalard Jean   commited 2018-03-02 16:20:22 +09:00
9cbc882c08
Minor clean-up in NetworkCapabilities
Follow up clean up for aosp/606338

Bug: 72828388
Test: frameworks/base/tests/net/ -c android.net.NetworkCapabilitiesTest
Change-Id: I2d2cfeb51caaa339602f7d97ffffed6e4cfad432

Pavel Maltsev   commited 2018-03-01 18:06:25 -08:00
15e839f111
Extend network request to query networks w/o capabilites
Add another bit mask into NetworkCapabilities class that represents
unwanted capabilities and corresponding methods to add and remove them.

Bug: 72828388
Bug: 68762530

Test: runtest -x frameworks/base/tests/net/
Change-Id: Ie291167eb74fdb696c7ee145c8cc46ea8115d6ba

Pavel Maltsev   commited 2018-03-01 17:52:02 -08:00
7c600431b5
Merge "Add OEM_PAID network capability"
Treehugger Robot   authored and   Gerrit Code Review   commited 2018-02-28 07:06:00 +00:00
2501283064
Correct bug in IpSecTransformTest
testCreateTransformsWithSameConfigEqual used assertFalse rather than
assertTrue

Bug: 69385347
Test: Passing on walleye
Change-Id: I8caa26e184e8bfc3e8acc9061d85c22d27ebf448

Benedict Wong   commited 2018-02-15 18:52:07 -08:00
b7ca6bf4c1
Add OEM_PAID network capability
Bug: 68762530

Test: runtest -x frameworks/base/tests/net/

Change-Id: I51c07e0c2211d631e90b27468c26b599e7b07bc8

Pavel Maltsev   commited 2018-02-15 10:46:00 -08:00
d4d611954e
Merge changes I3d68dbf8,I6ea524bb,I978d9119
* changes:
  Deprecate CONNECTIVITY_ACTION.
  Publish FOREGROUND and add NOT_SUSPENDED capabilities.
  Send null UIDs to apps instead of single-uid lists.

Chalard Jean   authored and   Gerrit Code Review   commited 2018-02-15 11:25:36 +00:00
91d3912eab
Publish FOREGROUND and add NOT_SUSPENDED capabilities.
NOT_SUSPENDED and FOREGROUND are capabilities that need to
be public so as to reach feature parity with what information
can be gotten through the use of CONNECTIVITY_ACTION and
synchronous calls to ConnectivityManager. This change makes
them public, and wires up the NOT_SUSPENDED capability.
This deprecates in effect the old onSuspended and onResumed
callbacks, but these have never been public.

This also converts the onAvailable path from a multiple
binder call design to a simpler, single binder call. This
is only for internal convenience

Test: runtest frameworks-net
Test: cts
Test: also manual testing
Change-Id: I6ea524bb361ecef0569ea2f9006c1e516378bc25

Chalard Jean   commited 2018-02-14 15:14:41 +09:00
a23bc9e501
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

Benedict Wong   commited 2018-02-13 23:23:13 +00:00
159abb6cff
MacAddress: Use SecureRandom and add a 46 bit randomized MAC generator
Use SecureRandom instead of Random since Random is time based and can
increase the chance of generating same MAC address across multiple
devices.

createRandomUnicastAddress should randomize all bits of the address,
except for locally assigned bit and unicast bit. The previous method
that only randomizes NIC and use Google Base OUI is renamed to
createRandomUnicastAddressWithGoogleBase.

Bug: 72450936
Test: runtest frameworks-net
Change-Id: Icda650638c2c1c9fd90d509a87e86347c0e05f2d

Jong Wook Kim   commited 2018-02-07 01:28:46 +00:00
93dd5e6964
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
753d9734d2
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
cd969ef97c
Merge "Add public API methods for private DNS."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2018-01-18 01:17:17 +00:00
6cba185910
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
7643abcbe3
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
60a21328d5
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
3865a008e7
Merge "Update netId to nethandle mapping in NetworkTest."
Treehugger Robot   authored and   Gerrit Code Review   commited 2018-01-16 12:23:02 +00:00
75c5e3dcb5
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
959f60b710
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
8f21758d4a
Move more core networking tests to framework/base/tests/net.
Test: "runtest frameworks-net" passes except for already-failing IpConnectivityMetricsTest
Change-Id: I2a20d546089699ac67bc819f10a8fcd50c637ac4

Lorenzo Colitti   commited 2018-01-10 23:35:16 +09:00
a4fdc1204e
MacAddress: address api review comments
1) toSafeString() is renamed to toOuiString()
2) toOuiString() returns a String that only contains the first 3 bytes
   of the mac address.

Bug: 70336442
Test: runtest frameworks-net
Change-Id: I798d8fec32dbff5687a682028e5d90eb941f81c1

Hugo Benichi   commited 2017-12-18 09:22:47 +09:00
3f83b8ad4e
Use consistent naming for allocating SPI.
Throughout the IPsec code (API, system server, netd) we use "reserve"
SPI and "allocate" SPI interchangeably. This renames to use "allocate"
everywhere for self-consistency and consistency with the kernel
(ALLOCSPI).

In javadoc, I am leaving the word "reserve" in several places because it
is still an accurate description of how the method behaves.

Bug: 69128142
Test: TreeHugger should be enough
Change-Id: I8ea603b4612303b0393beef04032671fa53d2106

Jonathan Basseri   authored and   Nathan Harold   commited 2017-12-12 13:50:35 -08:00
fbe3a82340
Merge "Fix bug in MacAddress.fromString()"
am: cdb84d2fc7

Change-Id: If4c85f0a5ea259f53f9cffa6eacb58fcde1fd1df

Hugo Benichi   authored and   android-build-merger   commited 2017-12-05 09:47:50 +00:00
a31109c229
Fix bug in MacAddress.fromString()
Test: runtest frameworks-net
Bug: 69390696
Change-Id: I83f01e4915092e08ed201d9b6738bb02498d3bba

Hugo Benichi   commited 2017-12-05 13:14:08 +09:00
21c7a52042
Merge "Validate IpSecAlgorithm Length"
am: 98ecd7efb2

Change-Id: I23f7612c119e67f9a1647568aeefde38a365f8da

nharold   authored and   android-build-merger   commited 2017-12-05 02:28:10 +00:00
2a20e7a677
Merge "Validate IpSecAlgorithm Length"
nharold   authored and   Gerrit Code Review   commited 2017-12-05 02:13:55 +00:00
98ecd7efb2
Merge "MacAddress: light refactors and improve documentation"
am: d871cab32d

Change-Id: I51bb8786ecd7f53e3342625c7a2625007eedfc0f

Hugo Benichi   authored and   android-build-merger   commited 2017-12-04 23:38:27 +00:00
56eeb80dc5
Validate IpSecAlgorithm Length
Improve the Validation of IpSecAlgorithm by
explicitly checking the length in addition to
the truncation length (previously an oversight).
In addition, we now check the lengths during
un-parceling, which will catch someone maliciously
manually building a parcel and passing it, bypassing
the checks in the constructor.

Bug: 68780091
Test: runtest -x IpSecAlgorithmTest.java
Change-Id: I8172762617264d34f47d5144336464510f07a701

Nathan Harold   commited 2017-12-04 15:12:14 -08:00
82c3470df9
MacAddress: light refactors and improve documentation
This patch does some light refactoring in MacAddress to prepare for
exposing MacAddress in the public api:
 - documention is improved
 - some method names are renamed
 - a toSafeString method is added
 - a padding bug in the conversion methods outputting strings for
   mac addresses is fixed

Bug: 69390696
Test: runtest frameworks-net
Change-Id: I399a97dabc2dfa8df9c5518c8b12484e43ca05c9

Hugo Benichi   commited 2017-12-04 22:34:43 +09:00
5bc3546cf6
Merge commit '98e12851336b7db16e583f9afac63ecc97465980' from
oc-mr1-dev-plus-aosp-without-vendor into stage-aosp-master.

Change-Id: Ia7b8da4a00d215160e4a4fa40f6044208d1297b7
Merged-In: I19846d2a3ee27aecbae2367a74ee49082eea154d

Xin Li   commited 2017-11-14 12:31:11 -08:00
acae66beee
MacAddress follow-up: define the core of the class
Test: new unit test parts of $ runtest frameworks-net
Change-Id: I08c57d2d656802f7bdd7a93fde711a7e77247583

Hugo Benichi   commited 2017-11-09 16:36:45 +09:00
d380d14c4d
Define MacAddress class
Test: new unit tests part of $ runtest frameworks-net
Change-Id: I5a6a868ff86e9bffdc551d4e2bb486b585525c30

Hugo Benichi   commited 2017-11-08 11:09:49 +09:00
88ad29b907