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
* 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 Robotauthored and Gerrit Code Reviewcommited 2024-04-11 07:26:14 +00:00
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
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
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
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
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
* changes:
Support prefix information option parsing in nduser netlink message.
Add PrefixInformation option struct to parse nduser option.
Create IpPrefix in PrefixInformationOption constructor
Patrick Rohrauthored and Gerrit Code Reviewcommited 2024-04-01 18:41:53 +00:00
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
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
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
* 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
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 Żenczykowskicommited 2024-03-19 21:33:55 +00:00
Allows compiler to turn some conditionals into constant
expressions and to simply the machine code.
Bug: 326744138
Change-Id: Ic0abed8c548986fe7ef1876bd1eb3e55ac6b8c10
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
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
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
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