Also remove the DEFAULT_LINK_MTU constant, it's dup with ETHER_MTU.
The caller should select the appropriate MTU based on specific link
layer MTU.
Bug: 138926174
Test: atest NetworkStackIntegrationTest
Change-Id: I85e2c487298efaa0032eff3914029801580bb2c4
Proxy is moving into connectivity mainline and its hidden methods
are not accessible outside the module. Thus, move the shared
methods and constants to ProxyUtils to share between module and
platform.
Bug: 172183305
Test: atest FrameworksNetTests
Test: atest CtsNetTestCases:ProxyInfoTest
Change-Id: I7153ce4e77b80964ffad67254b6329973ed61f30
The getNetworkPart() method is used by Settings and wifi. The
method was inside NetworkUtils, but NetworkUtils is moving
to connectivity mainline module. Methods in NetworkUtils will
not be accessible outside module. Thus, move the shared method
and the corresponding helper method to share lib.
Bug: 172183305
Test: atest FrameworksNetTests
Change-Id: Ic39f0debf1146dd84db962857dcead6b498aec49
This patch creates a class in the static lib that contains utils
of NetworkIdentity.
Test: atest NetworkIdentityUtilsTest
Bug: 174123988
Change-Id: I6f0780190017b5eef3312b764107ac1f00e06833
PermissionMonitor is using ArrayUtils#indexOf often in checking
permission methods. It's better to have this method in
CollectionUtils.
Also implement contains() by indexOf method.
Bug: 174541037
Test: atest FrameworksNetTests
Change-Id: I32e2ca815dd35eae9c31188856068eaf3458d250
Some files which will be inside mainline module depend on
NetworkManagementService to talk to netd, but after they become
a part of mainline module, they cannot access @hide API of
NetworkManagementService.
So create a NetdUtils to help them to talk to netd.
Bug: 170598012
Test: atest CtsNetTestCasesLatestSdk NetdStaticLibTests
Change-Id: I8bee1204b9533b70844da0b3768427438fd0c890
Some files which will be inside mainline module depend on
NetworkManagementService to talk to netd, but after they become
a part of mainline module, they cannot access @hide API of
NetworkManagementService.
So create a NetdUtils to help them to talk to netd.
Bug: 170598012
Test: atest CtsNetTestCasesLatestSdk NetdStaticLibTests
Change-Id: I8bee1204b9533b70844da0b3768427438fd0c890
(there's bpf related stuff in here)
Test: N/A
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I7fcc19cdf48e468dfcbe5ee34f7bc07e261756b8
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
This isn't new code, this is basically copied verbatim from
//system/bpf/libbpf_android/include/bpf/BpfUtils.h
Test: atest BpfMapTest, TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I80523c9ee0c1e4431f3192eb409ad68c737390a6
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
Lots of methods are needed to check if the caller has any of
permission. So add PermissionUtils to support
enforceAnyPermissionOf() and checkAnyPermissionOf() usage.
Bug: 177187957
Test: buid, flash, boot to home.
Change-Id: Ie282989f1e73b614093feff28c497af6573a9ef8
Move BaseNetdUnsolicitedEventListener from tethering module to
frameworks/libs/net and have a new library for it.
Tethering module can still use BaseNetdUnsolicitedEventListener
through netd-client and ConnectivityService and Nat464Xlat also
can use it when both of them are under frameworks/base.
Bug: 174837473
Test: Manual test and check the log.
Change-Id: I44dff1c7639e50b8f20b54c6d5733139b20e2986
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
Adjusting visibility to accomodate migration of
frameworks/opt/net/wifi to packages/modules/Wifi.
BUG: 137323948
Test: TH
Change-Id: Iee3f2dc6fc5f3262fa9e81626a3e15a3226e4ab7
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
Add paths to visibility needed for tests.
Soong allows specifying paths w/o validation. Once the
migration is complete, we can remove the old path in
visibility rules.
BUG: 137323948
Test: TH
Merged-In: Id19c650246a8f3d55d7b6a874840a6eebcd9eb17
Change-Id: I68de6a67b978ed5a2e721adf41329af349076696
Exempt-From-Owner-Approval: Cleanup CL