aosp/3218864 fixed the crash when ranges are removed from a
destroyed network, but did not fix the case where the ranges are
added to a destroyed network.
This can happen if a multilayer request is filed when a network
has already been destroyed.
Fix: 368989698
Test: updated existing tests for this bug
Change-Id: I7184eaa01141f56b7ad774277c7dee03d5812298
Lorenzo Colitticommited 2024-10-22 11:41:21 +00:00
Use HandlerUtils#ensureRunningOnHandlerThread to perform handler
thread checks instead of individual methods within the class.
Test: TH
Change-Id: I6d893dc9eedc588660797768a03e7ad7ab636479
This CL exposes PrivateAddressCoordinator methods at
RoutingCoordinatorManager and implements the methods in
RoutingCoordinatorService.
The objective is to allow a system service like Thread to request an
IPv4 address allocation.
Bug: 350699020
Change-Id: I65dc309f0b503d544e0fddc1168131fa6174796c
Since this is just a special case of a bpf cgroup hook,
it really should be in netd.o with all other such hooks.
Besides moving/renaming the map & programs this should be a no-op.
Test: TreeHugger, atest bpf_existence_test
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I4a2aedaf77f89a9c0a96fa1c369d80659535eabe
Maciej Żenczykowskicommited 2024-09-19 00:40:53 +00:00
Handler thread updates mDefaultNetworkRequests and Multiple threads
read/iterate mDefaultNetworkRequests without locking.
This caused NPE when there is concurrent updates and iterations.
This CL fixed this issue by using CopyOnWriteArraySet.
CopyOnWriteArraySet is suitable since number of default network request
is small (system default network request + per-app default network
requests) and updated infrequently but read frequently.
Bug: 293978451
Test: TH
Change-Id: Iaefe8e6e31c2b5257ebc51b4f848c3a7197781cb
See Lorenzo's comment on aosp/3243843 for why.
Test: TreeHugger, atest CtsNetTestCases:android.net.cts.DscpPolicyTest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I43cab1ee009ec53174fb102ca60ee91b3049857c
Maciej Żenczykowskicommited 2024-09-04 21:32:04 +00:00
INGRESS_TO_VPN_ADDRESS_FILTERING is disabled due to b/352424251 and
testDropPacketToVpnAddress fails if the feature is disabled.
So skip testDropPacketToVpnAddress if the feature is disabled.
Bug: 362434644
Test: adb shell device_config put tethering
ingress_to_vpn_address_filtering -1
Test: atest CtsHostsideNetworkTests
Change-Id: Ib16a7550dcf93dd9ecf29047b1c4f101ff6d610d
This is needed to cleanly flag on/off DDR and to ensure that
when it is flagged on, DnsResolver ignores the hardcoded list of
DoH providers and only uses DDR.
Bug: 240259333
Test: updated existing tests
Change-Id: I84c103a5a4d18294b6a4cc3301d0037d1a6673a4
Lorenzo Colitticommited 2024-08-23 18:23:42 +09:00
networkRemoveUidRangesParcel throws ServiceSpecificException if the
native network is already destroyed.
This can happen when
1) per-app default network request is satisfied by network1
2) unregisterAfterReplacement is called to the network1. This calls
netd.networkDestroy and network is removed from netd.
3) per-app default network request is removed. This calls
netd.networkRemoveUidRangesParcel but netd does not know about this
netid anymore.
This CL fixes this issue by skip calling networkRemoveUidRangesParcel if
the request satisfier is already destroyed.
Bug: 336961452
Bug: 357974842
Test: CSSatelliteNetworkTest
Change-Id: Id775cca6fffd03545f1c4bc5016d0de4813f17df
OEM VPNs might need to receive packets to VPN address via
non-VPN interface.
Bug: 352424251
Test: CsIngressDiscardRuleTest
Change-Id: Ia9000bcbb5b3b9e1e0d396ba78946be36e2fc5ba
"Shrinked" should actually be "shrunk" or "shrunken"; in any case
"minimized" is simpler and possibly more accurate (it's the minimum size
required to hold the values).
Test: atest
Change-Id: If787d3f3d6e1046338d4e89ed924bce183e74bd6
To avoid filling the binder buffers, and sending unnecessary callbacks
when apps are unfrozen (for example successive LinkProperties changes or
onAvailable+onLost are not useful), queue and aggregate callbacks for
apps that are suspended.
Test: atest
Bug: 327038794
Bug: 279392981
Change-Id: I6de357ac2834f1f7e960dfbaa63adfc3825f2a82
Some legacy VPNs need to receive packets to VPN address via
non-VPN interface.
Bug: 352424251
Test: CsIngressDiscardRuleTest
Change-Id: Iad06dc69c5bf5ccda476e89ed9b0fc1bc63d2ebe
No-op refactoring of ConnectivityService, in preparation for a change to
suspend callbacks for frozen apps.
Test: atest
Bug: 327038794
Bug: 279392981
Change-Id: I55bdd6c1244d6829d40223883ca148ce9ac5dca8
Add a flag to be used for an optimization to queue callbacks while apps
are frozen, instead of filling the binder buffer.
Bug: 327038794
Bug: 279392981
Test: atest
Change-Id: I6cc2507de88fae3d0866f9831e1e9026200297e4
The class will be used to build memory-efficient objects (int arrays)
used to queue ConnectivityService callbacks while an app is frozen.
This is very similar to an ArrayList<Pair<Short, Short>>, but avoids
object boxing which would use a lot more memory.
This is intended to be used by ConnectivityService both as a builder,
and as a utility to read lists of callbacks that it stores. Long-lived
references to the CallbackQueue would not be kept to minimize memory
usage; only the array returned by toArray needs to be stored.
Test: atest
Bug: 327038794
Bug: 279392981
Change-Id: I187ea15d14dfd160e577e9e9e87b1aded27b1938
This CL calls UserHandle.getAppId to make sure the UID check with
Process.SYSTEM_UID and PHONE_UID are multiple-user-aware.
In multiuser context, Process.SYSTEM_UID or PHONE_UID is NOT the UID
of system/phone but the app id. The complete UID is prefixed with
user id (e.g. 1001001 is phone UID for user 10).
Bug: 328511085
Test: atest FrameworksNetCommonTests
Flag: EXEMPT Tiny bug fix
Change-Id: I97bbfcff37374ba367fc8d62400ae140136cd012
rambowangauthored and Rambo Wangcommited 2024-07-09 17:37:27 +00:00
- This CL puts RoutingCoordinator into staticlibs to make it usable by
both Tethering and ConnectivityService on R.
- This CL also changes the return type of
ConnectivityInternalApi#getRoutingCoordinatorManager() to IBinder so
it has fewer dependencies.
Bug: 350699020
Test: CI
Change-Id: Iba096e940795cd33e61c5141721394ad39e5ce6d
Instead of printing the flags as hex, use flag names for known flags.
Bug: 327038794
Bug: 279392981
Test: atest
Change-Id: I11ba4de1e8e60d5468a72b275cd724be669b32bc
Bug: 350514743
When dump of networkDiagnostics is triggered, if there is any error when performing IcmpCheck and DnsUdpCheck measurements, the failure is recorded and the method is returned.
The socket fds are not closed leading to open sockets and file descriptor leak.
This change is to call close() on the open sockets in case of an error in the catch block.
The following is logs collected by dumping network diagnostics via "adb shell dumpsys connectivity --diag", and introducing an exception in setupSocket method.
===
//Without the fix, an error in setupSocket leaves open fds.
01-01 00:25:45.611 1179 32581 I NetworkDiagnostics: setupSocket mFileDescriptor = java.io.FileDescriptor@b9983db
01-01 00:25:45.612 1179 32580 I NetworkDiagnostics: IcmpCheck catchblock open mFileDescriptor = java.io.FileDescriptor@cec0e78
01-01 00:25:45.612 1179 32582 I NetworkDiagnostics: setupSocket mFileDescriptor = java.io.FileDescriptor@5bae951
01-01 00:25:45.613 1179 32582 I NetworkDiagnostics: DnsUdpCheck catchblock open mFileDescriptor = java.io.FileDescriptor@5bae951
//With the fix, the open fds are closed.
01-01 00:30:00.884 1179 8744 I NetworkDiagnostics: setupSocket mFileDescriptor = java.io.FileDescriptor@1aa20a2
01-01 00:30:00.885 1179 8744 I NetworkDiagnostics: IcmpCheck catchblock open mFileDescriptor = java.io.FileDescriptor@1aa20a2
01-01 00:30:00.885 1179 8744 I NetworkDiagnostics: IcmpCheck catchblock closing mFileDescriptor= java.io.FileDescriptor@1aa20a2
01-01 00:30:00.885 1179 8744 I NetworkDiagnostics: closeQuietly mFileDescriptor = java.io.FileDescriptor@1aa20a2
01-01 00:30:00.885 1179 8746 I NetworkDiagnostics: setupSocket mFileDescriptor = java.io.FileDescriptor@aad7133
01-01 00:30:00.886 1179 8746 I NetworkDiagnostics: DnsUdpCheck catchblock open mFileDescriptor = java.io.FileDescriptor@aad7133
01-01 00:30:00.886 1179 8746 I NetworkDiagnostics: DnsUdpCheck catchblock closing mFileDescriptor= java.io.FileDescriptor@aad7133
01-01 00:30:00.886 1179 8746 I NetworkDiagnostics: closeQuietly mFileDescriptor = java.io.FileDescriptor@aad7133
===
Change-Id: I92f30af1b7b98813bd946bd3d9fd506f15367eab
Signed-off-by: Alekhya Karavadi <akaravad@ford.com>
Address review comment on aosp/3027487
This CL also adds test for enforceMeteredApnPolicy
Test: CSBlockedReasonsTest
Bug: 344800107
Change-Id: Ib531bf5b34566fc91fec9f977c5257b332189706
This reverts commit I93b8b94dcad8f2bc4d022314372fb97109ed8f2f.
Reason for revert: ClatIngress6Value and ClatEgress4Value are written to by the clatd.c program (reference aosp/3002596). Due to this, SingleWriterBpfMap is unsuitable in this scenario, as it can only be used when no BPF program ever writes to the map.
Change-Id: I382bbfc8554391c6c83a39bbea155114202b71a8
Most users of NetworkCallback do not override all methods, so callbacks
from ConnectivityService end up being unused by the app.
To save resources, check which callback methods are overridden in
ConnectivityManager, and inform ConnectivityService so it can skip
preparing and sending the corresponding binder calls when the callback
is not used by the app.
This is flagged off by default.
Test: flag enabled: atest CtsNetTestCases ConnectivityCoverageTests
Bug: 327038794
Bug: 279392981
Change-Id: Iaf490f416fb6e1437d40497fba1a40a899a9f523
This reverts commit fe956d9189.
This is targetting mainline release M-2024-09.
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: If89337854d677fdef1389b85cea645715a5e8491
Maciej Żenczykowskicommited 2024-06-21 15:14:33 +00:00
This reverts commit 9161b153b4.
This is targetting mainline release M-2024-09.
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I3d053f8c006eee8c1cbc7918f6fc5e30f5d09375
Maciej Żenczykowskicommited 2024-06-21 15:14:20 +00:00
this is to fix some lint issues
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I8c4dff0c8a6ba28596a346fef40f698962e7094b
Maciej Żenczykowskicommited 2024-06-16 05:22:58 -07:00