Commit Graph

1238 Commits

Author SHA1 Message Date
Bob Badour
e3b2f3cffb [automerger skipped] [LSC] Add LOCAL_LICENSE_KINDS to frameworks/libs/net am: a119946899 am: e99a4b20cd am: bc3f1f3fd3 -s ours
am skip reason: Change-Id I6942c6844c89048f785f2b6eaa4bb33a24fa6f93 with SHA-1 72e3e74277 is in history

Original change: https://android-review.googlesource.com/c/platform/frameworks/libs/net/+/1588168

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I3e3e11150d029c91497129b2babd333b23d6ccfa
2021-02-18 05:24:21 +00:00
Bob Badour
5e043f16a9 [LSC] Add LOCAL_LICENSE_KINDS to frameworks/libs/net
Added SPDX-license-identifier-Apache-2.0 to:
  client-libs/Android.bp
  client-libs/tests/unit/Android.bp
  common/Android.bp
  common/native/bpf_syscall_wrappers/Android.bp
  common/native/netjniutils/Android.bp
  common/tests/unit/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work

Change-Id: I2d4abaee12c1f20c39a7e2c9e02e2fccb96fa3ee
Merged-in: I6942c6844c89048f785f2b6eaa4bb33a24fa6f93
2021-02-17 17:22:02 -08:00
Bob Badour
1b8c744bcd [LSC] Add LOCAL_LICENSE_KINDS to frameworks/libs/net
Added SPDX-license-identifier-Apache-2.0 to:
  client-libs/Android.bp
  client-libs/tests/unit/Android.bp
  common/Android.bp
  common/native/bpf_syscall_wrappers/Android.bp
  common/native/netjniutils/Android.bp
  common/tests/unit/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work

Change-Id: I2d4abaee12c1f20c39a7e2c9e02e2fccb96fa3ee
Merged-in: I6942c6844c89048f785f2b6eaa4bb33a24fa6f93
2021-02-17 17:22:02 -08:00
Xiao Ma
5310fc53b7 Merge "Add the constant for IPv6 all-routers/nodes/hosts multicast address." 2021-02-11 02:40:43 +00:00
Treehugger Robot
466c222072 Merge "Specify version for aidl_interface explicitly" 2021-02-09 02:12:36 +00:00
Xiao Ma
e50bee1b98 Add the constant for IPv6 all-routers/nodes/hosts multicast address.
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
2021-02-09 02:10:56 +00:00
Chiachang Wang
4a16b01983 Merge "Move shared methods and constants from Proxy to shared lib" 2021-02-08 10:27:05 +00:00
Chiachang Wang
c291b2137f Move shared methods and constants from Proxy to shared lib
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
2021-02-08 10:26:33 +00:00
Jeongik Cha
e59cf43d08 Specify version for aidl_interface explicitly
Bug: 150578172
Test: m
Change-Id: I8b1e35a84e4ad4be479fd1508f06514879b174da
2021-02-06 09:56:14 +00:00
Serik Beketayev
3d475dc578 [Mainline] Core Platform APIs migration
* java/net/InetAddress;->parseNumericAddress(Ljava/lang/String;)Ljava/net/InetAddress;
* libcore/io/IoUtils;->closeQuietly(Ljava/io/FileDescriptor;)V
* libcore/io/IoUtils;->closeQuietly(Ljava/lang/AutoCloseable;)V
* libcore/io/IoUtils;->setBlocking(Ljava/io/FileDescriptor;Z)V
* java/net/Inet4Address;->ANY:Ljava/net/InetAddress;
* java/net/Inet6Address;->ANY:Ljava/net/InetAddress;

Bug: 177260833
Test: mma
Change-Id: I1357dba41beb27df17a7631317c4b05f98854f27
2021-02-04 15:42:25 -08:00
Chiachang Wang
2e7313af5c Move shared methods to NetUtils
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
2021-02-03 10:53:47 +00:00
junyulai
f51099dae3 [FUI21.1] Create NetworkIdentityUtils class
This patch creates a class in the static lib that contains utils
of NetworkIdentity.

Test: atest NetworkIdentityUtilsTest
Bug: 174123988
Change-Id: I6f0780190017b5eef3312b764107ac1f00e06833
2021-02-03 11:48:07 +08:00
paulhu
e658c7b5dd Add indexOf method
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
2021-02-02 22:22:16 +08:00
Lucas Lin
935948f1de Merge "Have a collection of utilities for netd - NetdUtils" 2021-02-02 03:38:37 +00:00
Lucas Lin
24da72cf4b Merge "Add common CollectionUtils.{any,all} methods." 2021-02-01 10:07:24 +00:00
lucaslin
5c620643b7 Have a collection of utilities for netd - NetdUtils
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
2021-02-01 07:24:37 +00:00
lucaslin
e2d02e7c98 Have a collection of utilities for netd - NetdUtils
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
2021-02-01 07:24:37 +00:00
lucaslin
a19b59d8fc Add common CollectionUtils.{any,all} methods.
Test: new tests for this
Change-Id: I482c958af499bf8cdc8824c9586e9da619cd1f39
2021-02-01 15:22:56 +08:00
David Su
dc0a5687d6 net-utils-services-common - set min_sdk_level to 30
Bug: 178711289
Test: compiles
Change-Id: I8105265b726cb095375191693caa0ccfd7d66276
2021-01-29 04:42:27 +00:00
Xiao Ma
d2eaad9e81 Merge "Support IPv4/6 address type in Struct." 2021-01-28 06:06:30 +00:00
Xiao Ma
229b17ac0c Support IPv4/6 address type in Struct.
Bug: 163492391
Test: atest NetworkStaticLibTests
Change-Id: I17a753ea495f24d186b69083923a71a7ebccdc7b
2021-01-21 02:46:29 +00:00
Maciej Żenczykowski
0d05d57b89 add maze to OWNERS for common/native
(there's bpf related stuff in here)

Test: N/A
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I7fcc19cdf48e468dfcbe5ee34f7bc07e261756b8
2021-01-19 18:34:13 -08:00
Xiao Ma
79c8682381 Merge changes I485e0bbc,I640f343d
* changes:
  Implement generic toString/equals/hashCode in Struct.
  Make a copy of HexDump in the frameworks/libs/net.
2021-01-19 04:03:16 +00:00
Xiao Ma
01c0fe5453 Implement generic toString/equals/hashCode in Struct.
Bug: 163492391
Test: atest NetworkStaticLibTests
Change-Id: I485e0bbc6949c1eb239d52401ff0403dd447619b
2021-01-19 04:02:37 +00:00
Xiao Ma
ef9fd0ae59 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
2021-01-18 16:52:41 +00:00
Chalard Jean
312b5519a2 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
2021-01-15 14:36:44 +09:00
Maciej Żenczykowski
02f9e5a413 Merge "Wrap BPF system calls into a versioned module" 2021-01-14 07:36:50 +00:00
Maciej Żenczykowski
a728a70497 Wrap BPF system calls into a versioned module
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
2021-01-13 18:29:56 -08:00
Paul Hu
8ad6b63d32 Merge "Add PermissionUtils" 2021-01-14 01:15:38 +00:00
Chalard Jean
54e2e4ca63 Merge "[NS01.5] Fix an embarrassing bug" 2021-01-13 13:53:39 +00:00
Chalard Jean
5b76d8d7dc [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
2021-01-13 08:04:26 +00:00
Treehugger Robot
297c490647 Merge "[NS01] Add scoreless methods for non-score users" 2021-01-12 10:21:36 +00:00
Nucca Chen
88b345aa42 Merge "Default write to byte array with native order" 2021-01-12 08:06:03 +00:00
Chalard Jean
6f99e869ef [NS01] Add scoreless methods for non-score users
Test: FrameworksNetTests NetworkStackTests
Change-Id: I9ebd5cf17ec96b3e7c09ff041d65ee88d0b37cbf
2021-01-12 16:31:12 +09:00
paulhu
caf7014b2f Add PermissionUtils
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
2021-01-12 07:17:58 +00:00
lucaslin
37a2effb07 Have a new library - netd-client in frameworks/libs/net
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
2021-01-08 13:56:12 +08:00
Remi NGUYEN VAN
df3191ada8 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
2021-01-07 12:05:30 +09:00
markchien
22bfada06e Default write to byte array with native order
Bug: 173167302
Test: atest BpfMapTest
      atest StructTest

Change-Id: I60a22ea4cd44697773d98d1720c02cc771643a9e
2021-01-05 00:38:54 +08:00
Baligh Uddin
ffe8f93ce4 Merge "Adjust visibility rules for migration" 2020-12-28 14:03:37 +00:00
Xiao Ma
ed82179342 Merge "Support common MacAddress Type in Struct." 2020-12-28 02:03:56 +00:00
Remi NGUYEN VAN
d5a89c61fd Merge changes from topic "netutils_split"
* changes:
  Add DeviceConfigUtils version caching and tests
  Add getDisplayTransport
  Split NetworkStackUtils to frameworks/libs/net
2020-12-28 01:17:41 +00:00
Baligh Uddin
fcbda3ac66 Adjust visibility rules for migration
Adjusting visibility to accomodate migration of
frameworks/opt/net/wifi to packages/modules/Wifi.

BUG: 137323948
Test: TH
Change-Id: Iee3f2dc6fc5f3262fa9e81626a3e15a3226e4ab7
2020-12-27 15:10:36 +00:00
Serik Beketayev
a3c54cb19b Merge "[Mainline] ProxyInfo migration" 2020-12-25 08:32:04 +00:00
Remi NGUYEN VAN
31c6d82be0 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
2020-12-25 16:48:33 +09:00
Remi NGUYEN VAN
a744975b3e 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
2020-12-25 16:23:34 +09:00
Remi NGUYEN VAN
b86b34da48 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
2020-12-25 16:23:25 +09:00
Xiao Ma
cd6104ff70 Merge "Add ETHER_BROADCAST and DEFAULT_LINK_MTU constants." 2020-12-25 01:38:03 +00:00
Serik Beketayev
57969d0ec9 [Mainline] ProxyInfo migration
Bug: 173455434
Test: mma

Change-Id: I49f7f491acc657051d9c79fc24605d4896cbc315
2020-12-23 22:15:42 -08:00
Xiao Ma
81a17c3fc6 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
2020-12-24 04:59:21 +00:00
Baligh Uddin
fe99df5a25 Add visibility rule for migration.
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
2020-12-24 03:28:41 +00:00