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 Żenczykowskicommited 2021-03-15 20:58:17 -07:00
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
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
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
The utilities replace the ones from IpClientIntegrationTests. Original
Kotlin implementation is aosp/1440812.
Bug: 168868607
Test: atest NetworkStackIntegrationTest
Change-Id: I1c050ae42d99f541eeaa3dcd80a53574ab9bc1c3
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
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
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
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
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
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
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
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
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
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
The constants are also useful for bootclasspath code, for example in
Ikev2VpnProfile.
Bug: 174436414
Test: atest FrameworksNetTests NetworkStackTests NetworkStaticLibTests
Change-Id: I34458fe6568a73533f956f86ed7bb50d45aa7d7e
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
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
The class only contains constants that should be shareable between
different modules and tests.
Bug: 168868607
Test: m
Change-Id: Ic382d24e73697d85d29fa226692bd0d64ffa0f1f
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