Commit Graph

546 Commits

Author SHA1 Message Date
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
Hugo Benichi
795f7d79f9 Merge "Import a few android.net unit tests into frameworks-net" am: f851fef87f am: bf80e2f376 am: 3d4d464f0a
am: cf9ab489de

Change-Id: I4922d8505e641652cea028c6d60a0f9996b130e6
2017-10-12 12:45:11 +00:00
Hugo Benichi
cf9ab489de Merge "Import a few android.net unit tests into frameworks-net" am: f851fef87f am: bf80e2f376
am: 3d4d464f0a

Change-Id: Icf9ccd265754f1b85720bb778633dc5ef515646e
2017-10-12 12:34:55 +00:00
Hugo Benichi
386407387b Merge "Migrate most of core networking tests to junit4" am: 649a997437 am: 06cfeaf51f am: c40687f85a
am: 470f4382fa

Change-Id: I44024c6cfe2bcb66f00a39ac9d97182ff62a23d1
2017-10-12 09:52:28 +00:00
Hugo Benichi
470f4382fa Merge "Migrate most of core networking tests to junit4" am: 649a997437 am: 06cfeaf51f
am: c40687f85a

Change-Id: Ic59ca37bbb31ba091c8b6d31170584b946c2527a
2017-10-12 09:43:11 +00:00
Hugo Benichi
87d306b45f Import a few android.net unit tests into frameworks-net
Bug: 62918393
Test: runtest frameworks-net
Change-Id: I3c7c60bcfeffec5c5ec287810312349237a2868a
2017-10-12 15:55:22 +09:00
Hugo Benichi
1c0f4e27bc Migrate most of core networking tests to junit4
This patch is a batch of mechanical changes to test classes to migrate
away from AndroidTestCase and TestCase.

Bug: 62918393
Test: runtest frameworks-net
Change-Id: I74134609e511f22c4d9ecd65780e981f9ba7ae3f
2017-10-12 15:26:09 +09:00
Chalard Jean
c3fbfeba01 Merge "Add some useful helpers and constants." am: ed8d236319 am: 316bc4e19c am: 06d401ae73
am: 0da609859d

Change-Id: I9bebe24f2c65ecaf31b70e02a45e0acd50e1430e
2017-10-06 10:21:43 +00:00
Chalard Jean
0da609859d Merge "Add some useful helpers and constants." am: ed8d236319 am: 316bc4e19c
am: 06d401ae73

Change-Id: Iaf611b8e39080d677c9cfe7edb124c11bbdf8a81
2017-10-06 10:11:04 +00:00
Chalard Jean
8c827b7eb2 Add some useful helpers and constants.
Test: Pulled out of a client app ; the client app is behaving
Test: identically to how it was behaving before. Wrote unit
Test: tests in frameworks-net.

Change-Id: I397137748a95c65cee2e1e1b243a1a260e83a6f7
2017-10-06 13:38:46 +09:00
nharold
73c55104e8 Merge changes from topic "ipsec-svc-cleanup" am: 9778c7884f am: 83d7776121 am: 4e793fd0b5
am: 869d47e66d

Change-Id: I7418f23141b26f23555397d231e8a73692c04085
2017-10-04 21:14:17 +00:00
nharold
869d47e66d Merge changes from topic "ipsec-svc-cleanup" am: 9778c7884f am: 83d7776121
am: 4e793fd0b5

Change-Id: Ib7eae5c9e223493281524e862979e16d25984dde
2017-10-04 20:53:04 +00:00
Nathan Harold
f69cb0a207 Split IpSecServiceTest to add IPv6 Tests
-Split IpSecServiceTest into parameterized
 and single tests.
-Add IPv6 parameters

Bug: 66954381
Test: this
Change-Id: Ib98c112560014f73bccc3d2842c31d297c7a07ef
2017-10-03 19:45:59 -07:00
Nathan Harold
4f4459d8c3 Add equals() for IpSecAlgorithm and IpSecConfig
Add equality testing methods to support tests
for parceling and un-parceling IpSecConfig.

Bug: 38397094
Test: runtest -x IpSecConfigTest.java
Change-Id: I31e318334d39ed6e9daf5ec8f3be7dcec75e12ad
2017-10-03 19:45:58 -07:00
Nathan Harold
bfbda18d48 Input Validation for IpSecService
All of the input to IpSecService over the Binder
interface needs to be validated both for sanity
and for safety.

-Sanity check all the parameters coming from binder.
-Added setters for IpSecConfig to decouple the test
 from the IpSecManager. This was needed because the
 input validation caused the tests to fail due to a
 null parameter that was previously un-tested.
-Added the mode flag to the IpSecConfig bundle this
 oversight was found during testing.
-Expose the getResourceId() methods for testing in
 UdpEncapsulationSocket, SecurityParameterIndex, and
 IpSecTransform classes.
-Remove the unneeded getIpSecConfig() from
 IpSecTransform: unneeded now that we can synthesize
 configs.

Bug: 38397094
Test: runtest frameworks-net
Change-Id: I5241fc7fbfa9816d54219acd8d81a9f7eef10dd4
2017-10-03 19:45:55 -07:00
Hugo Benichi
1cae2642ad Merge "DO NOT MERGE Ignore DUN in describeImmutableDifferences" into oc-mr1-dev
am: b2f4b2e05d

Change-Id: I0236132b8b497af5b1c26aa44e6494fe0510cb6d
2017-10-02 11:10:37 +00:00
Hugo Benichi
b2f4b2e05d Merge "DO NOT MERGE Ignore DUN in describeImmutableDifferences" into oc-mr1-dev 2017-10-02 10:57:01 +00:00
Hugo Benichi
a8565a7716 Merge "ConnectivityServiceTest: fix flaky testNetworkRequestMaximum" am: 1211941aa0 am: ca67954314
am: eced6cd14a

Change-Id: I53d0d6755c8e0be34db66da56efa483006e538ac
2017-10-02 10:51:21 +00:00
Hugo Benichi
2a84d1cbcf ConnectivityServiceTest: fix flaky testNetworkRequestMaximum
Registered requests are not keyed by PendingIntents in
ConnectivityService, which means that unregistering a request with a
PendingIntent causes a linear search in all registered requests.

testNetworkRequestMaximum was registering too many PendingIntents
simultaneously, causing the unregistration loop to have n^2
complexity and to take a long time to take effect.

To make the unregistering loop less likely to trigger a timeout on
waitForIdle, this patch changes the test to not register MAX_REQUEST
number of PendingIntent, but instead mixes a small number of
PendingIntents with NetworkCallbacks to reach MAX_REQUEST number of
simultaneously registered requests.

When unregistering these requests, callbacks are unregistered first.

Bug: 32561414
Test: runtest frameworks-net
Change-Id: I48b882c884abe20b388190b7f28baee293446f37
2017-10-02 17:37:57 +09:00
Hugo Benichi
7f9a223134 DO NOT MERGE Ignore DUN in describeImmutableDifferences
This patch changes describeImmutableDifferences in NetworkCapabilities
to ignore differences in NET_CAPABILITY_DUN, so that updateCapabilities
in ConnectivityService to not report wtf errors when a NetworkAgent
degrades its NetworkCapabilities object by removing NET_CAPABILITY_DUN.

Bug: 65257223
Test: runtest frameworks-net
Change-Id: I115ed1b366da01a3f8c3c6e97e0db8ce995fd377
2017-10-02 15:03:57 +09:00
Hugo Benichi
66749201a1 Merge "Fix NPE in NsdServiceTest" am: c30decbfe8 am: a9177b3748
am: a5d620ae92

Change-Id: Ieb299771438fe55566b76271815e52d02da799c8
2017-09-28 12:35:03 +00:00
Hugo Benichi
c30decbfe8 Merge "Fix NPE in NsdServiceTest" 2017-09-28 12:13:18 +00:00
Hugo Benichi
210ab83b77 Fix NPE in NsdServiceTest
Continuous test dashboards report that quit() can crash sometimes
due to mThread being null.

This patch adds a null guard in tearDown().

Bug: 32561414
Test: runtest frameworks-net
Change-Id: If66fb47e31e77d25b4741a786f12eb78f0b9102e
2017-09-28 15:22:13 +09:00
Lorenzo Colitti
f384a58f79 Merge "Delete the legacy framework code for manipulating ND offload." am: 3c0bf71eee am: fc56002707
am: bb21618a86

Change-Id: I07d9753e214af311d3dcab6f8016442f60388700
2017-09-27 11:05:29 +00:00
Lorenzo Colitti
3c0bf71eee Merge "Delete the legacy framework code for manipulating ND offload." 2017-09-27 10:46:36 +00:00
Lorenzo Colitti
d6cc68dab4 Merge "Declare support for Ethernet if the service is running." am: 21fcca6818 am: 5b906e1d11
am: a6648cc90b

Change-Id: Iafd9807ab76ce4e4ab1fd506d7b0e2b2b7017751
2017-09-27 08:51:51 +00:00
Lorenzo Colitti
2c9dd64d94 Declare support for Ethernet if the service is running.
On some devices, support for TYPE_ETHERNET is not specified in
the networkAttributes config resource, even though the device is
capable of supporting Ethernet (e.g., via USB host adapters).
This leads to Ethernet working but various connectivity APIs
behaving as if it was not - for example, no CONNECTIVITY_ACTION
broadcasts will be issues when it connects or disconnects.

Ensure that ConnectivityService always treats Ethernet as
available if the service is running. Currently the service is
started if the device supports FEATURE_ETHERNET or
FEATURE_USB_HOST.

(cherry picked from commit 7bbe3eee52c08ee92a81b7bed395ca5499554cc4)

Bug: 37359230
Test: bullhead builds, boots
Test: ConnectivityServiceTest passes
Test: Ethernet is available even if removed from networkAttributes resource
Test: ConnectivityManagerTest CTS test passes
Change-Id: I9b6db4edeaf966ee6715011dd92770b9d25dd938
Merged-In: I9b6db4edeaf966ee6715011dd92770b9d25dd938
2017-09-27 17:35:06 +09:00
Treehugger Robot
21fcca6818 Merge "Declare support for Ethernet if the service is running." 2017-09-27 08:23:34 +00:00
Lorenzo Colitti
19d4cd99f5 Delete the legacy framework code for manipulating ND offload.
This only worked on broadcom devices, and was superseded in
M by a wifi HAL call made by IpManager.

Test: bullhead builds, boots
Change-Id: I711cae7dafe171c2c8b4e84a229adbcad27f3d14
2017-09-27 16:47:36 +09:00
Lorenzo Colitti
23e9afc702 Declare support for Ethernet if the service is running.
On some devices, support for TYPE_ETHERNET is not specified in
the networkAttributes config resource, even though the device is
capable of supporting Ethernet (e.g., via USB host adapters).
This leads to Ethernet working but various connectivity APIs
behaving as if it was not - for example, no CONNECTIVITY_ACTION
broadcasts will be issues when it connects or disconnects.

Ensure that ConnectivityService always treats Ethernet as
available if the service is running. Currently the service is
started if the device supports FEATURE_ETHERNET or
FEATURE_USB_HOST.

Bug: 37359230
Test: bullhead builds, boots
Test: ConnectivityServiceTest passes
Test: Ethernet is available even if removed from networkAttributes resource
Test: ConnectivityManagerTest CTS test passes
Change-Id: I58801bf4f0bbdc3ff6345ec6bfdc911ce045c8ab
2017-09-27 13:03:10 +09:00
Hugo Benichi
883604a9fd Merge changes Ia47e566b,Ib94d79a9 am: d8eae0de70 am: 53eee16439
am: b91bd88c5e

Change-Id: Ied2b31c9d1219b8aebf5fec085ab598b77bede6e
2017-09-26 13:05:41 +00:00