Some callers (e.g. iwlan) need to learn about system default
network but they cannot have NETWORK_SETTINGS permission.
To allow them to use this API but prevent from misuse by
unprivileged apps, enforce USE_RESTRICTED_NETWORKS for this API.
Test: atest com.android.server.ConnectivityServiceTest#testRegisterPrivilegedDefaultCallbacksRequireNetworkSettings android.net.cts.ConnectivityManagerTest#testRegisterNetworkCallback
Fix: 242456635
Change-Id: I80ab27445af874328c9c0f4814a8fbf035ae5df4
* changes:
ethernet: cleanup updateConfiguration tests
ethernet: fix callbacks for running interfaces
ethernet: test callbacks when adding running interface
ethernet: ensure EthernetOutcomeReceiver receives only one result
ethernet: fix enable/disableInterface result
ethernet: remove enable/disable interface unit test
Unfortunately, TestableNetworkCallback.expectCapabilitiesWith cannot be
used as it expects to be passed a HasNetwork object.
Test: atest EthernetManagerTest
Change-Id: I0b88bc8b51711db4464608a5075dec32a1fc8ef7
updateInterfaceState(true) changes the interface state and triggers an
interface state callback. In addition, maybeTrackInterface() always
sends out a callback (which is correct, as for an interface that is
being added, maybeTrackInterface() would send the initial DOWN
callback). setTetheringInterfaceMode() (the other caller of
addInterface) also already sends its own callback.
Test: atest EthernetManagerTest
Change-Id: I60d884db5e788639b035cad1dd0d6c316e5836f7
Sending multiple callbacks to one receiver is an easy trap to fall into.
Asserting that the future has not completed in EthernetOutcomeReceiver
should catch this mistake.
Test: atest EthernetManagerTest
Change-Id: Iaaace0e6604558bfc2fc1ae58c2744185e0b13ca
Calling enableInterface() / disableInterface() for an interface already
in the correct state used to return an error which is incorrect
according to the API specification in EthernetManager. onError() is now
only returned for untracked and server mode interfaces.
This change also fixes the updateInterfaceState() function signature.
Test: atest EthernetManagerTest
Change-Id: Ie7ee84c3756a8a0c489a38548214fd524352c8da
This unit test is not particularly useful and there is already coverage
in EthernetManagerTest.
Test: test only change.
Change-Id: I6f9d19d9603229553f44d562ff0276567cb0e26d
- Delete test case from CTS. This would be moved to unit test
- Use reasonable key value in DataElementTest
Test: -m CtsNearbyFastPairTestCases
Bug: 244133414
Change-Id: Ia476c64ad5ebedd8eb007f7e0cb5b30a1d12dee5
- Fix the wrong MOBIKE value set in
testStartPlatformVpnHandlesNetworkLoss_mobikeEnabled.
- Verify the networkAgent is unregistered when the default
network is lost
Bug: 231749077
Test: atest FrameworksNetTests:VpnTest
Change-Id: Idc6ebd42090eff1135dc5f96af4bc2fb268dd340
Starting to listen on the handler races with the rest of
the constructor. The class already has a #start() method
meant to start listening, so implement better practices
by leveraging this method.
Test: CtsNetTestCases
FrameworksNetIntegrationTests
FrameworksNetTests
Change-Id: I772f761d3ca5f9711b9d988e6330b0878814f491
* changes:
DscpPolicy: remove v6 default route as it is added by the RA
deflake DscpPolicyTest
Update DscpPolicyTest to use random IPv6 prefixes.
DscpPolicyTest: annotate with ConnectivityModuleTest
DscpPolicy BPF Add Checksum Validation to Test
DscpPolicyTest: fix linter errors
Only test testTetherClatTcp on S+ device because R device test
is blocked on b/234727688.
Bug: 234727688
Test: atest EthernetTetheringTest
Change-Id: I65a4a8c4fe13b8320b036380b9038af094ac95a5
This converts the key, which is an index in an array, of sConfigurationMap from U32 to S32.
Since the array has exactly 2 elements, there's no real difference.
In addition while the kernel does indeed index arrays with U32s,
it doesn't matter, because you'd need to have over 2 billion
elements in the bpf map (at which point you'd need GBs of ram for
the bpf map itself)...
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: If17efc25d910af642e519f9ecb6d0e8695c38d42
This converts the key, which is a uid, of sUidOwnerMap & sUidPermissionMap from U32 to S32.
The kernel is actually not consistent in whether uids & gids
are signed or unsigned, and neither is our Java code, which
also commonly uses just 'int' for uid. In practice values
greater or equal to 2**31 often don't quite work right.
For example icmp sockets are enabled via a sysctl that
takes a minimum and maximum gid - and these are signed int32s.
It's worth pointing out that these functions already accept int's
as arguments, so when converting them to U32 (and thus long) they
technically previously did the wrong thing (though it's unlikely
it ever mattered).
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I7b389a1cf822c56134b20df5ded269963f5bf69f