Commit graph android_packages_modules_Co.../staticlibs
Message SHA1
Merge "Use helper function getIndexForValue in MulticastRoutingCoordinator." into main
Yang Sun   authored and   Gerrit Code Review   commited 2024-04-23 12:58:39 +00:00
173ffb9278
Use helper function getIndexForValue in MulticastRoutingCoordinator.
The SparseArray.indexOfValue() uses == to compare values,
MulticastRoutingCoordinator uses SparseArray with String type values,
and the indexOfValue function would sometimes return -1 when looking for
a value in the SparseArray.

Added a helper function getIndexForValue in CollectionUtils to get index
by comparing values with equals, and used this function in MulticastRoutingCoordinator.

Updated
MulticastRoutingCoordinatorServiceTest#testMulticastRouting_applyConfigNone_removesMfc
test case to use copies of interface names when updating the multicast
configs, so the test would fail without this fix.

Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.CollectionUtilsTest#testGetIndexForValue
atest android.net.connectivity.com.android.server.connectivity.MulticastRoutingCoordinatorServiceTest#testMulticastRouting_applyConfigNone_removesMfc

Change-Id: I862242d6be01b8552cdd6af6c9691948a9f0bfe0

Yang Sun   commited 2024-04-23 17:22:15 +08:00
4e7baadc71
Merge "Add prefixmsg struct to parse RTM_NEWPREFIX message header." into main
Xiao Ma   authored and   Gerrit Code Review   commited 2024-04-16 08:19:59 +00:00
22d42e6079
Add prefix_cacheinfo struct to parse PREFIX_CACHEINFO attribute.
Bug: 315069348
Test: TH
Change-Id: I6a2cd40ab81fa079cdd6bd309dd48387c6faf146

Xiao Ma   commited 2024-04-16 14:56:25 +09:00
44df982062
Add prefixmsg struct to parse RTM_NEWPREFIX message header.
Bug: 315069348
Test: TH
Change-Id: I8bc5bee20f3043203f591bdfe31a4879a09d1565

Xiao Ma   commited 2024-04-16 14:54:51 +09:00
a25a09d2c2
Merge "Convert RTM_NEWPREFIX nlmsg type to string in stringForRtMsgType()." into main
Xiao Ma   authored and   Gerrit Code Review   commited 2024-04-16 00:12:22 +00:00
52b6244b67
Add missing mcts tags
Bug: 318608673
Change-Id: I9f7e3aee05af700881f145002fd9a076afd4db7a

Tongbo Liu   commited 2024-04-15 04:48:36 +00:00
65ce1f2aa2
Convert RTM_NEWPREFIX nlmsg type to string in stringForRtMsgType().
Bug: 315069348
Test: TH
Change-Id: I6773bd467484e444e30a3b504b8969a6aac446d6

Xiao Ma   commited 2024-04-15 13:06:51 +09:00
8d1cad9a11
Merge "Add RTM_NEWPREFIX and RTMGRP_IPV6_PREFIX netlink message constants." into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-04-12 03:54:35 +00:00
76b02a456c
Add RTM_NEWPREFIX and RTMGRP_IPV6_PREFIX netlink message constants.
Bug: 315069348
Test: TH
Change-Id: Ic0b12b71020a3207f9f7a4759ae39f05282741c2

Xiao Ma   commited 2024-04-11 17:38:12 +09:00
c6e2d82510
Merge "Request INTERNET capability in ensureWifiConnected" into main
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2024-04-11 08:20:51 +00:00
cbcbec8bc1
Merge changes from topic "rate-limit-trafficstats" into main
* changes:
  Make cache duration and max entries configurable
  Create TestRule: SetFeatureFlagsRule
  Rate-limit on TrafficStats#get*[Bytes|Packets] API calls
  Clear TrafficStats cache before getting readings from TrafficStats

Treehugger Robot   authored and   Gerrit Code Review   commited 2024-04-11 07:26:14 +00:00
47c819640d
Merge "Migrate ConnectivityManagerTest to callback rule" into main
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2024-04-11 02:32:13 +00:00
2d23887beb
Request INTERNET capability in ensureWifiConnected
The intention of ensureWifiConnected is to connect to a "standard"
wifi network that has internet capability.

Add the capability to avoid selecting alternate wifi networks.

Test: atest
Change-Id: I20caa34feebe9d5449f4fcd8ae00fd91dd17dc5d

Remi NGUYEN VAN   commited 2024-04-10 15:29:30 +09:00
689f1cbb6d
Migrate ConnectivityManagerTest to callback rule
ConnectivityManagerTest has existing logic that is functionally
identical to AutoReleaseNetworkCallbackRule. Migrate it to use the rule
instead.

This just migrates callbacks to their Rule equivalents, except for
waitForActiveNetworkMetered which relied on the NetworkStack
ConnectivityManager shim for registerSystemDefaultNetworkCallback on R
to use a fallback implementation. Use the same NetworkRequest as
ConnectivityManagerShim as a direct fallback in this case.

Test: atest
Change-Id: I06501a5b7c05071667344bedb08e9b824c03b27c

Remi NGUYEN VAN   commited 2024-04-10 15:27:08 +09:00
93b08e202e
Merge "Drop circular dependency" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-04-08 12:51:28 +00:00
588a9d5b26
Create TestRule: SetFeatureFlagsRule
This rule works by reading the annotation and dynamically
invoking a user-specified method before evaluation to handle the feature flag configuration.

Usage:
class MyTestClass {
  @get:Rule
  val setFeatureFlagsRule = SetFeatureFlagsRule(setFlagsMethod = (name, enabled) -> {
    // Custom handling code.
  })

  // ... test methods with @FeatureFlag annotations
  @FeatureFlag("FooBar1", true)
  @FeatureFlag("FooBar2", false)
  @Test
  fun testFooBar() {}
}

Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.net.NetworkStatsServiceTest
Bug: N/A
Change-Id: I439e8ee40b8e81b6eb3857925912a3b843e8dfa1

Junyu Lai   commited 2024-04-08 10:43:42 +08:00
5ed8003915
Merge "Improve the nduser option log readability." into main
Xiao Ma   authored and   Gerrit Code Review   commited 2024-04-08 01:25:21 +00:00
1cf1b5f785
Improve the nduser option log readability.
Before:
Nduseroptmsg(10, 40, 48, 134, 0, fe80::2a00:79e1🔤f605%wlan0)

after:
Nduseroptmsg(family:10, opts_len:40, ifindex:48, icmp_type:134, icmp_code:0, srcaddr: fe80::2a00:79e1🔤f605%wlan1, NdOptRdnss(type: 25, length: 5, reserved: 0, lifetime: 1209600,servers:[2001:4860:4860::6464,2001:4860:4860::64]))

Bug: 315069348
Test: TH
Change-Id: I3abfbecd53a8cc00eaed9cbac1d9fe187d265847

Xiao Ma   commited 2024-04-05 18:25:54 +09:00
6fc458350a
Drop circular dependency
There was a circular dependency between net-tests-utils-host-common and
ConnectivityTestPreparer. This hasn't caught because Soong didn't track
the required dependency (ConnectivityTestPreparer requires the other).
However, as Soong is fixed to track the dependency type, this is caught
as an error.

Dropping the "required" dependency because net-tests-utils-host-common
is a host test module and is the entry point.

Bug: 321626681
Test: m
Change-Id: I539bbe2689be0af52bfec35966dd8210137d6c72

Jiyong Park   commited 2024-04-05 14:34:10 +09:00
093a4cfa95
Merge "Replace connectToCell -> NetworkCallbackRule" into main
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2024-04-03 04:15:41 +00:00
d5a8d41172
Merge "Do faster bitmask checks on NetworkCapabilities" into main
Shai Barack   authored and   Gerrit Code Review   commited 2024-04-02 18:32:40 +00:00
0634c7c4d2
Replace connectToCell -> NetworkCallbackRule
Developers often forget to unregister requests in tests, and cleanup
code also makes tests more verbose.

Add a rule that unregisters callbacks automatically when after each test
method.

Replace current usage of connectToCell with this rule, as well as
network callback usage in CaptivePortalTest (which is one example that
did not unregister its callback).

Test: atest
Change-Id: Ie3b9c5cf529004b7b3af04bc13a7e69acfbbaa18

Remi NGUYEN VAN   commited 2024-04-02 11:18:20 +09:00
e629bb7c84
Merge changes Ie882a5c7,Id94b6538,I58eda41f into main
* changes:
  Support prefix information option parsing in nduser netlink message.
  Add PrefixInformation option struct to parse nduser option.
  Create IpPrefix in PrefixInformationOption constructor

Patrick Rohr   authored and   Gerrit Code Review   commited 2024-04-01 18:41:53 +00:00
da9dfa2207
Merge "Changes to support satellite stats appear as TYPE_MOBILE" into main
Nagendra Prasad Nagarle Basavaraju   authored and   Gerrit Code Review   commited 2024-04-01 14:33:37 +00:00
ad48c49ee0
Changes to support satellite stats appear as TYPE_MOBILE
With satellite transport supported at device and satellite
network to appear under type mobile, considers cellular or
satellite, or combination of both interfaces under mobile interfaces.

Note: getUidStatsForTransport(TRANSPORT_SATELLITE) is not supported,
considering the same interface name could be used by cellular as well,
supporting this might lead to double counting problem.

Bug: 329003473
Test: atest FrameworksNetTests
Change-Id: I85465cedcc5550fa0555dc36b3be364ac90aade1

Nagendra Prasad Nagarle Basavaraju   commited 2024-04-01 10:53:02 +00:00
756ca07f80
Support prefix information option parsing in nduser netlink message.
Bug: 315069348
Test: atest NetworkStaticLibTests
Change-Id: Ie882a5c721befd4384858140a1f0706a0247d3a1

Xiao Ma   commited 2024-04-01 16:06:02 +09:00
5485bb84f1
Add PrefixInformation option struct to parse nduser option.
This is helpful for user space to get the PIO option via netlink message
and check whether the P flag is set or not, this bit flag determines if
we should start DHCPv6 PD process for IPv6 provisioning.

Bug: 315069348
Test: atest NetworkStaticLibTests
Change-Id: Id94b6538c5d88fe43c262ab23c30ccd53c766a62

Xiao Ma   commited 2024-04-01 16:05:59 +09:00
e20dc5ae89
Create IpPrefix in PrefixInformationOption constructor
The constructor is invoked during Struct#parse() at which point we might
as well try to create the IpPrefix object which will be used later. If
this fails for some reason (UnknownHostException or ClassCastException),
the prefix is bogus and should not be used.

Bug: 315069348
Test: TH
Change-Id: I58eda41f98b774fe97389beb1b84e164634a20d3

Xiao Ma   commited 2024-04-01 12:51:19 +09:00
5d3dcb0d64
Add isFeatureEnabled API for CaptivePortalLogin experiment namespace.
Bug: 329361366
Test: atest NetworkStaticLibTests
Change-Id: I3421f04bdace03221a3d6bde27da1d2ffd61e789

Xiao Ma   commited 2024-03-28 08:35:08 +00:00
12f7fd26af
Merge "Separate Struct.java into its own lib." into main
Yang Sun   authored and   Gerrit Code Review   commited 2024-03-28 06:23:57 +00:00
68d68d82ed
Separate Struct.java into its own lib.
* Struct.java is removed from net-utils-device-common-bpf and
  net-utils-device-common-struct's source list
* Created a lib net-utils-device-common-struct-base for Struct.java
* Updated libs that require Struct.java to include
  net-utils-device-common-struct-base.
* Replaced net-utils-multicast-forwarding-structs with
  net-utils-device-common-struct in service-connectivity

Bug: 323503345

Test: build tethering module.
Change-Id: I3f60715c3d8043b7569db7612dee9d4fa1ccba59

Yang Sun   commited 2024-03-27 20:15:17 +08:00
3aa62e6773
Merge "Make PrefixInformationOption struct constructor visible for testing." into main
Xiao Ma   authored and   Gerrit Code Review   commited 2024-03-26 02:49:46 +00:00
f74488eb37
NetBpfLoad: enable mainline on T+
Note:
   2 == BPFLOADER_S_VERSION
  19 == BPFLOADER_T_VERSION
  25 == BPFLOADER_OBJ_AT_VER_VERSION
  33 == BPFLOADER_IGNORED_ON_VERSION
  37 == BPFLOADER_U_VERSION [*]
  41 == BPFLOADER_V_VERSION [**]
and currently we have:
  42 == BPFLOADER_MAINLINE_VERSION
  43 == BPFLOADER_MAINLINE_T_VERSION
  44 == BPFLOADER_MAINLINE_U_VERSION
  45 == BPFLOADER_MAINLINE_V_VERSION

[*] udc-dev/udc-release are actually 38, as 37 was some earlier
    udc beta2 (2.1 ifirc), and beta3+ switched to 38

[**] 24Q{1,2}-release (ie. U QPR2+) are technically actually 41,
     but their platform bpfloader no longer even looks in /apex/com.android.tethering/etc/bpf/...
     so it doesn't really matter (although 24Q1's platform
     netbpfload still does, however that is obsoleted by
     this change)

Thus we need to (as minimum for NetBpfLoad):
  BPFLOADER_T_VERSION -> BPFLOADER_MAINLINE_T_VERSION
  BPFLOADER_IGNORED_ON_VERSION -> BPFLOADER_MAINLINE_U_VERSION
to cause these to load appropriately from mainline.

One would perhaps also expect (as minimum for NetBpfLoad):
  BPFLOADER_OBJ_AT_VERSION -> BPFLOADER_MAINLINE_U_VERSION
but (as maximum for platform bpfloader):
  BPFLOADER_OBJ_AT_VERSION -> BPFLOADER_MAINLINE_U_VERSION

However, since the goal is actually for those to load via mainline on T+,
(with the 'old' version of the .o's loading on S via platform bpfloader)
thus one actually needs (as minimum for NetBpfLoad):
  BPFLOADER_OBJ_AT_VERSION -> BPFLOADER_MAINLINE_T_VERSION
and (as maximum for platform bpfloader):
  BPFLOADER_OBJ_AT_VERSION -> BPFLOADER_T_VERSION

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I4b688692ffca0db7ead20cefd9e7e892ca92c70a

Maciej Żenczykowski   commited 2024-03-19 21:33:55 +00:00
11141da623
Do faster bitmask checks on NetworkCapabilities
Allows compiler to turn some conditionals into constant
expressions and to simply the machine code.

Bug: 326744138

Change-Id: Ic0abed8c548986fe7ef1876bd1eb3e55ac6b8c10

Shai Barack   commited 2024-03-19 04:15:40 +00:00
70e7011a07
NetBpfLoad: chose bpfloader version at runtime based on Android OS
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Iee55d9c6f828f05d4096dff2e874abc6c41eadeb

Maciej Żenczykowski   commited 2024-03-18 15:02:53 -07:00
65f7022461
Make PrefixInformationOption struct constructor visible for testing.
PrefixInformationOption#build always gives the correct option length and
type, visible constructor is easiler to verify the incorrect parameters
in the test, for example, we will verify the code that parses the PIO
option in RA as a ND user option in netlink message.

Bug: 315069348
Test: TH
Change-Id: I6b88e6718cb873b15936c1f518d357c36c41ffde

Xiao Ma   commited 2024-03-18 15:12:35 +09:00
f0959a78a2
Eliminate spurious COMPILE_FOR_BPFLOADER_VERSION macro
and make platform bpf.o's target V's platform bpfloader.

Note that all mainline shipped bpf.o's already manually
specify BPFLOADER_MIN_VER.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I67b73969def24e1e169c70c5fb1a402bf6e8cabc

Maciej Żenczykowski   commited 2024-03-15 18:14:16 +00:00
0de80f1a9f
Merge "Quit NetworkMonitor threads in integration tests" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-03-15 09:17:11 +00:00
2fae00cb39
Quit NetworkMonitor threads in integration tests
Similarly to NetworkMonitorTest, terminate NetworkMonitor threads and
ExecutorServices after each test case in integration tests.

This should fix flakes where the HTTP probe from testValidation could
finish after mock probe responses are cleared in tearDown.

The utils used in NetworkMonitorTest are factored out to ConcurrentUtils
to achieve that.

Fixes: 292481238
Test: atest --rerun-until-failure 50
Change-Id: I5cdeee8d4f06ea40e338dd2cb1fdcc2fe0907a7d

Remi NGUYEN VAN   commited 2024-03-14 13:18:44 +09:00
b3fcdacfae
add #define BPFLOADER_MAINLINE_VERSION 42u
See: //packages/modules/Connectivity/netbpfload/loader.cpp
  // This is Network BpfLoader v0.42
  #define BPFLOADER_VERSION_MAJOR 0u
  #define BPFLOADER_VERSION_MINOR 42u

Test: N/A
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ieeed6d402de06d3f01e151c2c9ee44270c53323c

Maciej Żenczykowski   commited 2024-03-12 06:31:36 +00:00
84aa9ea83a
bpf_helpers: add #defines for next 2 LTS KVERs
Test: N/A
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Iac303578071ff5dd3848f63c7497180d7694874b

Maciej Żenczykowski   commited 2024-03-10 22:11:54 +00:00
978b3f2d9b
Add IPv6 FragmentHeader struct support am: f8c7d15850
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2988169

Change-Id: I5e48997648b57ade9affae0c6c5b99cc7dc738e9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

KH Shi   authored and   Automerger Merge Worker   commited 2024-03-06 05:50:39 +00:00
2759673568
Add IPv6 FragmentHeader struct support
Bug: 285124667
Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.structs.FragmentHeaderTest
Change-Id: I90c8a52daa35589977333494355ac239ea057204

KH Shi   commited 2024-03-06 05:05:13 +00:00
f8c7d15850
Merge "Remove unused library visibility" into main am: 2154e525b3
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2984492

Change-Id: I743bbcd9adab85c243416f6723fa1560114fe965
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Chiachang Wang   authored and   Automerger Merge Worker   commited 2024-03-04 02:59:53 +00:00
8a7c9f6c5f
Merge "Remove unused library visibility" into main
Chiachang Wang   authored and   Gerrit Code Review   commited 2024-03-04 02:43:27 +00:00
2154e525b3
Remove unused library visibility
This commit removes the unused library visibility.

The "frameworks/base/packages/Connectivity" folder is the
temporary folder for modulizing the connectivity codes. There is
no such need now.

Test: m
Change-Id: Ia2890fe64c1bc369fcb90be645263bc56c98a7b2

Chiachang Wang   commited 2024-03-01 00:57:52 +00:00
52d329642a
Merge "Include structs lib in service-connectivity-pre-jarjar" into main am: db67a80430
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2966917

Change-Id: I5021d8019cdf6685c86fa9ce9ee9279474065629
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Yang Sun   authored and   Automerger Merge Worker   commited 2024-02-29 03:34:05 +00:00
e5a99273a8
Merge "Include structs lib in service-connectivity-pre-jarjar" into main
Yang Sun   authored and   Gerrit Code Review   commited 2024-02-29 03:16:28 +00:00
db67a80430
Include structs lib in service-connectivity-pre-jarjar
To use the java struct definitions for multicast routing in connectivity
service, a new lib is defined and included in
service-connectivity-pre-jarjar.

Bug: 323503345

Test: presubmit
Change-Id: I664602fd0fa0a5da136ea28fd3c4d9068c5b46ab

Yang Sun   commited 2024-02-26 17:28:04 +08:00
1c9fb59004