Commit Graph

536 Commits

Author SHA1 Message Date
nharold
809bcfc45e Merge changes from topic "ipsec-oneway-transform"
* changes:
  Update IpSecService UnitTests
  Make Transforms Unidirectional
2018-01-17 08:40:37 +00:00
Nathan Harold
a25233123b 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
2018-01-16 11:08:31 -08:00
Lorenzo Colitti
870a596ed3 Merge "Update netId to nethandle mapping in NetworkTest." am: a04d0cc72f am: 503135596b
am: d9d2a71d6f

Change-Id: I6feaa589fc43ff8ee1635be0fbd58aaa25679a5a
2018-01-16 13:46:46 +00:00
Treehugger Robot
a04d0cc72f Merge "Update netId to nethandle mapping in NetworkTest." 2018-01-16 12:23:02 +00:00
Hugo Benichi
060f3cc2b5 Merge "MacAddress: add @NonNull annotations" am: e65a016d76 am: a7c125e5b2
am: 697b7fe9e1

Change-Id: Ib525e2429609ce12c2be5bbeacffa217b65bebe3
2018-01-16 10:40:56 +00:00
Lorenzo Colitti
8bdf996b17 Update netId to nethandle mapping in NetworkTest.
Bug: 63052780
Test: NetworkTest now passes
Change-Id: I5f1cb3055b7042a19afb5dd62f082912157612ba
2018-01-16 17:19:04 +09:00
Hugo Benichi
48872c6342 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
2018-01-16 13:32:59 +09:00
Lorenzo Colitti
4bc8984ec8 Merge "Move more core networking tests to framework/base/tests/net." am: d6c3813c08 am: 8f852c341f
am: 56dba0323a

Change-Id: I1eb98a82426d7b7e085316f8a67cdd1e81912538
2018-01-11 04:17:51 +00:00
Erik Kline
ccd67750bc Merge "Refactor to InterfaceParams utility class" am: 6a91687bcd am: fe83298cd5
am: 2be133a54e

Change-Id: I878be7b33afcad9544515e90da4db02fe85b92cc
2018-01-11 04:09:49 +00:00
Lorenzo Colitti
d6c3813c08 Merge "Move more core networking tests to framework/base/tests/net." 2018-01-11 03:09:40 +00:00
Erik Kline
8bd00d5f7c Refactor to InterfaceParams utility class
NetworkInterface throws Exceptions every time you look at it askance.
Try to make something we instantiate fully, once, and pass it around.

Partial MacAddress-ification as well, for good measure.

Test: as follows
    - built
    - flashed
    - booted
    - runtest frameworks-net passes
    - basic IPv6 tethering works
Bug: 32163131
Bug: 62476366
Change-Id: I16c145fddb4e76387370338d792a438eed886d7f
2018-01-11 09:47:40 +09:00
Lorenzo Colitti
6fbb21a8dc Move more core networking tests to framework/base/tests/net.
Test: "runtest frameworks-net" passes except for already-failing IpConnectivityMetricsTest
Change-Id: I2a20d546089699ac67bc819f10a8fcd50c637ac4
2018-01-10 23:35:16 +09:00
Hugo Benichi
824565dfba 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
Merged-In: I798d8fec32dbff5687a682028e5d90eb941f81c1

(cherry pick from commit a0ecf38d30)
2017-12-21 08:34:05 +09:00
Hugo Benichi
a0ecf38d30 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
2017-12-18 09:22:47 +09:00
Erik Kline
648aee9407 Merge "Revert "Send empty LinkProperties when entering StoppedState."" am: e8a4cb13e9 am: bb8c1a501a
am: 327462b2f7

Change-Id: Ie43fa6ffba91df2d38011d17008c8033ad29cf7b
2017-12-15 07:37:48 +00:00
Erik Kline
e8a4cb13e9 Merge "Revert "Send empty LinkProperties when entering StoppedState."" 2017-12-15 07:09:24 +00:00
Erik Kline
85ca6f75c6 Merge "Send empty LinkProperties when entering StoppedState." am: 5557fe3e2d am: de336f18f9
am: d71ec3be6f

Change-Id: Ie775de7719bedc4fb0d1a50a3be6acad9651a9d9
2017-12-15 06:57:20 +00:00
Erik Kline
652044a7db Revert "Send empty LinkProperties when entering StoppedState."
This reverts commit 94209ab768.

Reason for revert: should not have auto-submitted prior to more extensive wifi team testing.

Change-Id: Ie81b10473caf34971226948038bc20dc4fa6a1ae
2017-12-15 06:36:50 +00:00
Treehugger Robot
5557fe3e2d Merge "Send empty LinkProperties when entering StoppedState." 2017-12-15 06:29:15 +00:00
nharold
ccb9365019 Merge "Use consistent naming for allocating SPI." am: bf48afea49 am: 4753ed4b1b
am: f71c95dfe4

Change-Id: Ib6845ab0d7f385fbd1d59c0179771542e12c8be0
2017-12-14 21:48:58 +00:00
Erik Kline
94209ab768 Send empty LinkProperties when entering StoppedState.
Additionally, no longer try to transition from within a State's
enter() method (this can encounter Log.wtf()s). Introduce some
CMD_JUMP_* commands and use deferMessage().

Test: as follows
    - built
    - flashed
    - booted
    - runtest frameworks-net passes (except for IpConnectivityMetricsTest failures)
    - manual changing from DHCP to static configurations works:
  2017-12-11T19:06:19.082 - INVOKE onLinkPropertiesChange({{InterfaceName: wlan0 LinkAddresses: []  Routes: [] DnsAddresses: [] Domains: null MTU: 0}})

Bug: 69800563
Bug: 70394432
Change-Id: Ice249a48b66806c0270ec3f11dd2e8e387d4e29b
2017-12-13 12:13:36 +09:00
Jonathan Basseri
5fb929032d 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
2017-12-12 13:50:35 -08:00
Roshan Pius
cde4484262 Merge "Revert "Send empty LinkProperties when entering StoppedState."" am: e339662247 am: 66c8516600
am: a312cf38f9

Change-Id: Ib7aff28ca5088bf5ebbc86ab7ee5c607e35d6a2b
2017-12-09 02:09:51 +00:00
Treehugger Robot
e339662247 Merge "Revert "Send empty LinkProperties when entering StoppedState."" 2017-12-09 01:34:07 +00:00
Roshan Pius
f1967c4125 Revert "Send empty LinkProperties when entering StoppedState."
This reverts commit b3f9f4a305.

Reason for revert: Crash in WifiStateMachine (b/70394432)

Change-Id: I3a96c822eddcebcdd6621cee878b865171d094e8
2017-12-08 22:29:50 +00:00
Erik Kline
60e07a09c9 Merge "Refactor to IpNeighborMonitor and single-threaded semantics" am: b501e7e25b am: c4ca15786f
am: 91bb7b17d2

Change-Id: I128763174d70cc4b5999f3fcda485604c006a24e
2017-12-08 06:21:03 +00:00
Treehugger Robot
b501e7e25b Merge "Refactor to IpNeighborMonitor and single-threaded semantics" 2017-12-08 05:44:26 +00:00
Erik Kline
ad2b492fe9 Merge "Send empty LinkProperties when entering StoppedState." am: efdca004ab am: 72aa5bbd4e
am: ca08e38e3a

Change-Id: Ia33d99f181f67f33b14c0c7552f934b089182c4a
2017-12-08 04:23:50 +00:00
Erik Kline
84714bffa1 Refactor to IpNeighborMonitor and single-threaded semantics
IpReachabilityMonitor (and IpNeighborMonitor) are only accessed from
the IpManager StateMachine's thread. Consequently lots of locking can
now be removed.

Additionally:
    - rename BlockingSocketReader to PacketReader
    - incorporate IpReachabilityMonitor output in dump()

Test: as follows
    - runtest frameworks-net passes
    - "adb shell ip neigh change <address> dev wlan0 nud failed"
      triggers wifi to disconnect
Bug: 62476366
Bug: 67013397
Change-Id: I18aca29ae0019a72a7e559c2832e0d9b0e33d81e
2017-12-08 11:12:05 +09:00
Erik Kline
b3f9f4a305 Send empty LinkProperties when entering StoppedState.
Test: as follows
    - built
    - flashed
    - booted
    - runtest frameworks-net passes
    - changing from DHCPv4 to static while continuously pinging the
      default gateway works jsut fine
    - dumpsys log shows that during the change we send the empty LP:
  12-06 08:46:51.085 - CMD_ON_QUIT wlan0/23 0 0 null [rcvd_in=StoppingState, proc_in=StoppingState]
  12-06 08:46:51.092 - INVOKE onLinkPropertiesChange({{InterfaceName: wlan0 LinkAddresses: []  Routes: [] DnsAddresses: [] Domains: null MTU: 0}})

Bug: 69800563
Change-Id: I01047e9a72fce718a167c592bf14406c3bab3ba9
2017-12-07 18:07:38 +09:00
Hugo Benichi
f5cf390e41 Merge "Fix bug in MacAddress.fromString()" am: cdb84d2fc7 am: 9d077ecd9d
am: 5d2bd6bf0c

Change-Id: I7df23a45618825b874658ccbbf1d1fda6b164954
2017-12-05 10:09:35 +00:00
Hugo Benichi
9d077ecd9d Merge "Fix bug in MacAddress.fromString()"
am: cdb84d2fc7

Change-Id: If4c85f0a5ea259f53f9cffa6eacb58fcde1fd1df
2017-12-05 09:47:50 +00:00
Hugo Benichi
d2c5b1925b Fix bug in MacAddress.fromString()
Test: runtest frameworks-net
Bug: 69390696
Change-Id: I83f01e4915092e08ed201d9b6738bb02498d3bba
2017-12-05 13:14:08 +09:00
nharold
b8ab1d404b Merge "Validate IpSecAlgorithm Length" am: 68b81299d2 am: 5e3d66e78b
am: 7a8f0dc0c0

Change-Id: I1a28d860ac7125afc1f82ac17d1834b0121c0e11
2017-12-05 02:46:06 +00:00
nharold
5e3d66e78b Merge "Validate IpSecAlgorithm Length"
am: 68b81299d2

Change-Id: I23f7612c119e67f9a1647568aeefde38a365f8da
2017-12-05 02:28:10 +00:00
nharold
68b81299d2 Merge "Validate IpSecAlgorithm Length" 2017-12-05 02:13:55 +00:00
Hugo Benichi
469f4f6010 Merge "MacAddress: light refactors and improve documentation" am: d871cab32d am: 2f7cb5752b
am: 13b2fa0f85

Change-Id: Iae0e87bcc9bd9c1ba98319f3b65f18f6743c02a0
2017-12-05 00:06:50 +00:00
Hugo Benichi
2f7cb5752b Merge "MacAddress: light refactors and improve documentation"
am: d871cab32d

Change-Id: I51bb8786ecd7f53e3342625c7a2625007eedfc0f
2017-12-04 23:38:27 +00:00
Nathan Harold
3349b26630 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
2017-12-04 15:12:14 -08:00
Hugo Benichi
84bb7fc761 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
2017-12-04 22:34:43 +09:00
Xin Li
220871a697 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
9c114081a8 Merge "MacAddress follow-up: define the core of the class" am: cd35c65b5b am: d39a50350a
am: f7c0f2e6bf

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

Change-Id: I1063cbb5a468818f68ee5406e52b6cd74c85c4bf
2017-11-09 12:43:52 +00:00
Hugo Benichi
ac52e40049 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
Hugo Benichi
ffdbb572e5 Merge "Define MacAddress class" am: 925349ac8f am: 37caaaa705
am: 76c2cd2a6a

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

Change-Id: I377de35ab9ce9d8bf44bd90295a2a41fbea06d7a
2017-11-08 06:46:49 +00:00
Hugo Benichi
59c8e423a8 Define MacAddress class
Test: new unit tests part of $ runtest frameworks-net
Change-Id: I5a6a868ff86e9bffdc551d4e2bb486b585525c30
2017-11-08 11:09:49 +09:00
Hugo Benichi
aab9077049 Merge "Refactor ApfFilter creation" am: 5e619dce66 am: 6c25e1e24d
am: 55939f351b

Change-Id: Iff87d6efa0bb55c84e852a84489a0218acd21100
2017-11-07 23:22:39 +00:00
Hugo Benichi
55939f351b Merge "Refactor ApfFilter creation" am: 5e619dce66
am: 6c25e1e24d

Change-Id: I3f406b08287092d4e2bc23f158693cea6f6646e4
2017-11-07 22:53:09 +00:00
Hugo Benichi
7216636a62 Refactor ApfFilter creation
This patch introduces a helper ApfConfiguration class for passing filter
parameters to the constructor of ApfFilter. The benefits are:
  - less parameter boilerplate across IpManager, ApfFilter, ApfTest
  - easier to add more parameters in the future (useful for hardware
    counters options and further gservices configurable options)

There is no functional changes otherwise.

Test: runtest frameworks-net
Change-Id: I47231c21df80bc36b6d4e15369748017b50b8da1
2017-11-07 21:42:39 +09:00