Commit graph android_packages_modules_Co.../staticlibs/device
Message SHA1
add NsHeader class and implement buildNsPacket()
This is a near trivial copy of NaHeader & buildNaPacket()

Test: builds
Bug: 154669942
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I3b9b15e23317363bf9556b06ddecf8a2bf967c61

Maciej Żenczykowski   commited 2021-03-15 20:58:17 -07:00
c36f0b3f46
Merge "Check the ByteArray actual size before writing it to ByteBuffer."
Xiao Ma   authored and   Gerrit Code Review   commited 2021-03-08 04:30:17 +00:00
08e32b9378
Address the comments left in the IPv6 utils change.
This follow-up change updates EtherType name in the Ethernet header
diagram, replaces "length" filed in the IPv6 header with "payloadLength",
and also make ND options constructor as package private to encapsulate
the constant params(e.g. ICMPv6 type/code).

Bug: 168868607
Test: atest NetworkStackIntegrationTest
Change-Id: Ia0500a7020fd9a85dce2a8c67c21b00b238a4e8d

Xiao Ma   commited 2021-03-08 02:36:34 +00:00
5fbc8d5dca
Check the ByteArray actual size before writing it to ByteBuffer.
ByteArray is the unique type whose actual size might be different
with the size delcared in the annotation, e.g, user initializes an
object manually, or mutates the byte array after parsing from
ByteBuffer. Therefore, checking the length of byte array is required
before writing the array value to output bytes array or ByteBuffer.

Bug: 163492391
Test: atest NetworkStaticLibTests
Change-Id: I28936a2afbe60dd2dadac803d08062df153b2588

Xiao Ma   commited 2021-03-03 02:53:33 +00:00
9164b775c1
Revert "Revert "Add utilities to create IPv6 ICMP messages.""
This reverts commit 405c1bfca93fa25ae1616a93ee6e2a1f76d87d1e.

Bug: 168868607
Test: atest NetworkStackIntegrationTest

Reason for revert: Roll forward the previous change and try to merge it one by one instead of using the topic, which should avoid the build broken on the sc-dev branch due to the deferred auto-merge process.

Change-Id: I751fbd9d978ed60206bab009212f621fe902f321

Xiao Ma   commited 2021-02-28 13:09:23 +00:00
5c1745477f
Revert "Add utilities to create IPv6 ICMP messages."
Revert "Rename net-utils-framework-common in FrameworksTelephony..."

Revert submission 1579863-ipv6_utils

Reason for revert: Build breakage
Bug: 181339273

Reverted Changes:
I0d3b133e5:Rename net-utils-framework-common in FrameworksTel...
I1c050ae42:Add utilities to create IPv6 ICMP messages.

Change-Id: I2b3a26d6fe22c24618e3cab61f717a8b991f2b4d

Rahul Sabnis   commited 2021-02-26 20:02:44 +00:00
9d4d4b28fb
Add utilities to create IPv6 ICMP messages.
The utilities replace the ones from IpClientIntegrationTests. Original
Kotlin implementation is aosp/1440812.

Bug: 168868607
Test: atest NetworkStackIntegrationTest
Change-Id: I1c050ae42d99f541eeaa3dcd80a53574ab9bc1c3

Xiao Ma   commited 2021-02-25 07:18:08 +00:00
6344a8cdae
Add a public test method to reset package version
Instead of having the cached version field protected, which is only
usable by DeviceConfigUtilsTest, have a public method to reset it to -1
so that other tests exercising feature flags can reset it before and
after running.

Bug: 173068192
Test: atest NetworkStaticLibTests
Change-Id: I8f5be3c91b2a47070507d5bf263e2e5d7d9d9d14

Remi NGUYEN VAN   commited 2021-02-19 10:08:58 +00:00
b9fc3ad8e3
Support IPv4/6 address type in Struct.
Bug: 163492391
Test: atest NetworkStaticLibTests
Change-Id: I17a753ea495f24d186b69083923a71a7ebccdc7b

Xiao Ma   commited 2021-01-21 02:46:29 +00:00
229b17ac0c
Merge changes I485e0bbc,I640f343d
* changes:
  Implement generic toString/equals/hashCode in Struct.
  Make a copy of HexDump in the frameworks/libs/net.

Xiao Ma   authored and   Gerrit Code Review   commited 2021-01-19 04:03:16 +00:00
79c8682381
Implement generic toString/equals/hashCode in Struct.
Bug: 163492391
Test: atest NetworkStaticLibTests
Change-Id: I485e0bbc6949c1eb239d52401ff0403dd447619b

Xiao Ma   commited 2021-01-19 04:02:37 +00:00
01c0fe5453
Make a copy of HexDump in the frameworks/libs/net.
Make HexDump as a part of module-shared library, being able to share
among of modules. As the first step, moving it to frameworks/libs/net
and be able to use inside net-utils-device-common.

Bug: 177622619
Test: m
Change-Id: I640f343dc6c334b7b4d44960cd043e32a989898d

Xiao Ma   commited 2021-01-18 16:52:41 +00:00
ef9fd0ae59
Fix an embarrassing bug... again.
For the same reason as aosp/1549479, the old method
needs to call the new one. It's not enough that they have
the same implementation ; when NF calls the old one, it
needs to indeed call the overridden new version.

Test: TH
Change-Id: I5e8700fc7455317da382f2328e3f548b3392ca41

Chalard Jean   commited 2021-01-15 14:36:44 +09:00
312b5519a2
Merge "[NS01.5] Fix an embarrassing bug"
Chalard Jean   authored and   Gerrit Code Review   commited 2021-01-13 13:53:39 +00:00
54e2e4ca63
[NS01.5] Fix an embarrassing bug
The existing implementations override the function with the
int, so the default impl of the function with the int has
to call the new one, not the other way around. Otherwise,
when implementations are migrated to overriding the new one
the old code continues to call the function with the int
and that wouldn't work as expected if it didn't call the
newly overridden method.

Test: TH
Change-Id: Ic31cec6481781e0185a0ba150be52390597737e7

Chalard Jean   commited 2021-01-13 08:04:26 +00:00
5b76d8d7dc
Merge "[NS01] Add scoreless methods for non-score users"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-01-12 10:21:36 +00:00
297c490647
Merge "Default write to byte array with native order"
Nucca Chen   authored and   Gerrit Code Review   commited 2021-01-12 08:06:03 +00:00
88b345aa42
[NS01] Add scoreless methods for non-score users
Test: FrameworksNetTests NetworkStackTests
Change-Id: I9ebd5cf17ec96b3e7c09ff041d65ee88d0b37cbf

Chalard Jean   commited 2021-01-12 16:31:12 +09:00
6f99e869ef
Move NetworkCapabilitiesUtils to framework-common
Also move CollectionUtils which is a dependency.

NetworkCapabilitiesUtils is needed in BatteryStatsImpl, which is in
frameworks/base/core, so it uses the framework-common library.

The current framework-common target cannot use androidx annotations due
to users of this filegroup. This is being addressed in another change;
use android.annotation annotations in the meantime.

Bug: 174436414
Test: m
Change-Id: Ie188572a6db7c1bea37550a3410d7d828409a902

Remi NGUYEN VAN   commited 2021-01-07 12:05:30 +09:00
df3191ada8
Default write to byte array with native order
Bug: 173167302
Test: atest BpfMapTest
      atest StructTest

Change-Id: I60a22ea4cd44697773d98d1720c02cc771643a9e

markchien   commited 2021-01-05 00:38:54 +08:00
22bfada06e
Merge "Support common MacAddress Type in Struct."
Xiao Ma   authored and   Gerrit Code Review   commited 2020-12-28 02:03:56 +00:00
ed82179342
Add DeviceConfigUtils version caching and tests
Querying the APK version can be relatively expensive, so cache it with a
static. Package version cannot change without restarting the process.

Also add some testing for flags being equal to the min/max values.

Bug: 17454103
Test: atest NetworkStaticLibTests
Change-Id: I18c298beb843e0a9f76162d353623bb15ab155f1

Remi NGUYEN VAN   commited 2020-12-25 16:48:33 +09:00
31c6d82be0
Add getDisplayTransport
While networks can have multiple transports, users generally think of
them as "wifi", "mobile data", "vpn" and expect them to be classified
as such in UI such as settings.
Add a getDisplayTransport utility that returns which transport should
be used for UI display, from a list of transports of a network.

Bug: 174436414
Test: atest NetworkStaticLibTests
Change-Id: Iaefb47bcaa2f6ce2e7a2ae5011c340154009ac3c

Remi NGUYEN VAN   commited 2020-12-25 16:23:34 +09:00
a744975b3e
Split NetworkStackUtils to frameworks/libs/net
Split DeviceConfig and collections-related utilities to CollectionUtils
and DeviceConfigUtils in frameworks/libs/net.

Also add implementations for contains(array, value), to avoid usage of
internal non-API utils.

The original tests are based on mockito-extended, so also add to
NetworkStackTests as a dependency. This also requires setting the test
app as debuggable in its manifest.

Bug: 17454103
Test: atest NetworkStaticLibTests
Change-Id: Ie9bed66a08b7370ebe50d0a7240b788f8b31aa77

Remi NGUYEN VAN   commited 2020-12-25 16:23:25 +09:00
b86b34da48
Support common MacAddress Type in Struct.
MacAddress class is helpful to represent a 48-bits long MAC Address,
we have to use 6-bytes array to interpret a MAC Address without a
specific annotation type. To better parse the MAC Address appeared
in the ether header, link-layer address option or Bpf class, it's
worth supporting this specific type.

Bug: 163492391
Test: atest NetworkStaticLibTests
Change-Id: I1f716e5d4f38372fc5b7ee32e208d55a072c1e51

Xiao Ma   commited 2020-12-24 04:59:21 +00:00
81a17c3fc6
Merge "Move util classes to their destination package"
Chalard Jean   authored and   Gerrit Code Review   commited 2020-12-21 05:35:09 +00:00
1aadbb0afd
Move Struct.java to com.android.net.module.util package.
Bug: 163492391
Test: atest NetworkStaticLibTests
Change-Id: If7d54f0356ce4d6426011914df0a2e85784daebd

Xiao Ma   commited 2020-12-17 15:36:23 +00:00
ce033d4824
Move util classes to their destination package
Test: FrameworksWifiTests FrameworksNetTests
Change-Id: I93e9cfd968e08f983e3fd9f7196c455c79a0f32d
Merged-In: Id19c650246a8f3d55d7b6a874840a6eebcd9eb17

Chalard Jean   commited 2020-12-16 08:50:20 +09:00
ceaf7d0edc
Add new APIs writeToByteBuffer/writeToBytes for generic Struct class.
Split the original U64/UBE64 into two groups: U63/UBE63 which could be
represented by long primitive directly and U64/UBE64 which should be
represented by BigInteger class.

Also fix the endianness-related issue to support both of big-endian or
little-endian input ByteBuffer, and writeToBytes API outputs the bytes
array in appropriate order then.

Bug: 163492391
Test: atest android.net.util.StructTest --rerun-until-failure
Change-Id: Ie9c07fac6dcfceb8efdf1d6b56ce6ff1e845f477

Xiao Ma   commited 2020-12-07 17:35:03 +09:00
f4cb6d6789
Add NetworkStackConstants to framework/
The constants are also useful for bootclasspath code, for example in
Ikev2VpnProfile.

Bug: 174436414
Test: atest FrameworksNetTests NetworkStackTests NetworkStaticLibTests
Change-Id: I34458fe6568a73533f956f86ed7bb50d45aa7d7e

Remi NGUYEN VAN   commited 2020-11-30 17:19:18 +09:00
1ba696dbf7
Introduce cache schema for generic Struct class.
Bug: 163492391
Test: atest android.net.util.StructTest --rerun-until-failure
Change-Id: Idffad7d3b907d8853ed7d296808a2e0e2736cbbe

Xiao Ma   commited 2020-11-24 18:03:07 +09:00
a76690a3b7
Merge "Improve code style in Struct.java and add tests for Type.U64 represented by long primitive."
Treehugger Robot   authored and   Gerrit Code Review   commited 2020-10-13 07:02:18 +00:00
bfd404c903
Improve code style in Struct.java and add tests for Type.U64 represented
by long primitive.

Bug: 163492391
Test: atest android.net.util.StructTest --rerun-until-failure
Change-Id: I0120d7ab063d9d170e8b6e6a6077f8f86db93d67

Xiao Ma   commited 2020-10-13 06:59:51 +00:00
ea53144db0
Merge "Move NetworkStackConstants to frameworks/libs/net"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2020-10-12 02:00:55 +00:00
9f0bde57d2
Define a generic class to parse structured message.
Bug: 163492391
Test: atest android.net.util.StructTest --rerun-until-failure
Change-Id: I1848984d80998d87acccc52287a351d27708dedc

Xiao Ma   commited 2020-10-09 18:25:34 +09:00
6f95cefd38
Move NetworkStackConstants to frameworks/libs/net
The class only contains constants that should be shareable between
different modules and tests.

This rolls forward the previous change that broke
FrameworksTelephonyTests, because adding net-utils-framework-common to
net-utils-device-common caused the tests to contain a jarjared version
of net-utils-framework-common inherited from telephony code, and a
non-jarjared version inherited from net-utils-device-common. This
resulted in duplicate classes after applying jarjar to the test, which
is not supported (the build system can deduplicate if two libs include
the same class, but jarjar fails if a class after rename conflicts with
an existing class).

This new change removes the dependency on net-utils-framework-common
from net-utils-device-common.

Bug: 168868607
Test: m

Change-Id: I34bad7ec79ef0fd03e5e40b643f0d85d686c53ec

Remi NGUYEN VAN   commited 2020-10-09 16:57:24 +09:00
e1979e7624
Revert "Move NetworkStackConstants to frameworks/libs/net"
Revert "Use new test utilities from frameworks/libs/net"

Revert submission 1440811-iputils_constants_move

Reason for revert: Likely broke build in b/170438226
Reverted Changes:
Ic382d24e7:Move NetworkStackConstants to frameworks/libs/net
I0d938e296:Use new test utilities from frameworks/libs/net

Change-Id: I5e41daa85af39cfab4261ddf790c2008b2630c15

Remi NGUYEN VAN   commited 2020-10-09 01:38:44 +00:00
b2cce59454
Move NetworkStackConstants to frameworks/libs/net
The class only contains constants that should be shareable between
different modules and tests.

Bug: 168868607
Test: m
Change-Id: Ic382d24e73697d85d29fa226692bd0d64ffa0f1f

Remi NGUYEN VAN   commited 2020-10-05 11:25:18 +09:00
8f415d0066
Move utilities to libs/net
These files used to be in the network stack directory, but the libs
directory is a much more suitable place for them.

Also fix a typo : ConcurrentIntepreter → ConcurrentInterpreter

Also move {FdEvents,Packet}Reader to internal annotations. That's
what they should have been using in the first place anyway.

Note that this does not fix preupload issues reported by
checkstyle to make review easier. The fixes are in a followup
patch to this one.

Test: checkbuild
Change-Id: I675077fd42cbb092c0e6bd56571f2fc022e582fd

Chalard Jean   commited 2020-07-30 22:10:51 +09:00
48c6c7d838