Applies multicast routing configs when they are updated in
LocalNetworkConfig, or when local network/upstream network
status changes.
Bug: 281217735
Test: atest CSLocalAgentTests
Change-Id: Ib1c43c645a367d0f91e5cf0a0d9f8e5883be2c40
The original patch (aosp/2891011) incorrectly counted TCP
sockets with keepalive enabled for VPNs. This issue was
caused by the UID range verification. On bypassable VPNs,
the socket mark is always correct. It's possible for an
app that is not in the UID ranges to establish a socket
on the VPN. But that socket should be counted for the
purposes of keepalive. The old code would correctly count
it and the new code will incorrectly not count it. Also,
the UID range verification does not help on non-bypassable
VPNs since the socket mark is always the mark of default
network, not the socket mark of the VPN.
Instead of reverting the entire patch, this commit
removes the UID range mechanism. The code refactoring from
the original commit (which used structured classes to read
socket information) has been kept as it is a valuable
improvement.
Bug: 320842519
Test: atest FrameworksNetTests
Change-Id: I00731796144c982b9fd4d9771f3d0db1f1529a89
This is no-op refactor to move utility methods from
ConnectivityService to a common place.
Test: atest NetworkStaticLibTests#com.android.net.moduletests.util.PermissionUtilsTest#testEnforcePackageNameMatchesUid
Bug: N/A
Change-Id: I5802dedcc91fa6e130a5c534bba5080ca37dbeec
This change includes:
1. Refactor the logic in Tethering#dump into utils class.
2. Move the utils class to a common place which could be referenced
from other sub-modules.
3. Add @MonitorThreadLeak annotation to enforce
there is no thread leak problem.
Test: atest FrameworksNetTests NetworkStaticLibTests
Test: atest ConnectivityCoverageTests:com.android.networkstack.tethering.TetheringTest#testDumpTetheringLog
Test: adb shell dumpsys tethering (with hardcoded exception)
Fix: 312669345
Change-Id: Ia6fdfeeec2110afa0ec9e056e9db3843748845c3
This reverts commit e3245081b1.
Reason for revert: The change is unsafe as it introduces code with writings to a separate thread whose message queue size is unlimited.
Test: atest FrameworksNetTests
Change-Id: I392a30f77cfbcd17f420e29f0944604fd789b10a
This reverts commit c0baea5406.
Reason for revert: Checking if culprit of b/317506400
Change-Id: Icbe9d993c6d4bfdf305f2a4c7b8422095c8846a6
Bug: 317506400
Rename checkSystemBarServicePermission to checkStatusBarServicePermission to be consistent with the actual permission name.
Bug: 307161342
Change-Id: Ib0d353d33f1fc64d298919c107d3bc6691dc0bfe
Test: build
BYPASS_INCLUSIVE_LANGUAGE_REASON=Using public API
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.CSBpfNetMapsTest
(on U and V devices respectively)
Bug: 297836825
Fix: 314858283
Change-Id: Ibeac8cd3a33468c6539234255328affc6b3f8ffe
aosp/2405720 allowed network owner uid to see allowed uids
But this breaked old cts.
This CL reverts the behavior for network owner uid.
Bug: 312093253
Bug: 313025186
Bug: 312196228
Test: TH
Change-Id: Iaa732d22f67ecce7678e68bb8b20cec526116dc9
Check if the bpf loader rc file is differs from the template files when
ConnectivityService starts. Use Log.wtf() to log the file if there is a
diff.
Bug: 312638861
Test: TH
Change-Id: I0b9ed9962ad0954a051a17b01357d04a0e655ff4
In multi-user environment, the App might not be installed by system user.
As a result, the ConnectivityService should use the packageManager from
the user's context to be able to read the property correctly.
Bug: 300274339
Test: TH
Change-Id: I5398c95562bcaf5752270b52f38cca1f02698ba1
In PrivateDnsConfig class, `useTls` is replaced with `mode`.
This CL a corresponding change.
Bug: 240259333
Test: atest ConnectivityCoverageTests
Change-Id: I60c53e52f287fc7fa05543603a62632d934bb2e6
* changes:
Rename hasCarrierPrivilege... to isCarrierServiceUid...
Detect discrepancies in subIds
Allow carrier service UIDs to access their own WiFi networks.
Jean Chalardauthored and Gerrit Code Reviewcommited 2023-11-20 06:55:04 +00:00
This method tests whether the UID is the carrier service
UID, not whether the UID has carrier privilege.
Note that in normal operation, the carrier service UID always
has carrier privilege.
Test: NetworkAgentTest
Change-Id: I30f8814cc0419a2d6bdbe75fdc82156516eba026
This tests that the network providers are subject to appropriate
limitations as to what they can set as allowedUids – both in the
positive (can do) case, and the negative (can't do) case.
Test: this
Change-Id: I115e2a4bc02ddcd03ecf2f35130fcb0378da22bd
This reverts commit 30fb9b1ca4.
Reason for revert: Potential culprit for CtsLibcoreTestCases test failures b/311612650
Change-Id: Ie7de97159f92a174476a8fa8ea83e3e01914aea1
Michał Brzezińskiauthored and Gerrit Code Reviewcommited 2023-11-17 11:18:56 +00:00
As a specialized network, a network with PRIORITIZE_* is not
generally a good default network, and might cause unexpected
charges if allowed to become one.
Test: CSDefaultNetworkTests
Change-Id: I8f7184f80bb987da720bd067862bd7a546a38e26
Ideally the rules should be set up before onAvailable is
sent, but onLocalNetworkChanged should be sent after.
The previous code had CSLocalAgentTests#testForwardingRules
flaky because it was waiting for onAvailable and immediately
checking that the routing rules have been set up.
There are other ways to fix this flake (e.g. wait for
onLocalNetworkChange in the test or add a timeout on
the verify(netd) call) but this patch probably implements
the best production code behavior.
Bug: 309688089
Test: CSLocalAgentTests#testForwardingRules 1'000 times
Before this patch : flakes after 50~200 iterations
After this patch : no flake in 1'000 iterations
Change-Id: I4dcccaa3607c1e28aa89f268f0c721d87b1e9466
This is a preliminary change for filtering sockets that is not
in the uid ranges for automatic on/off keepalives. This commit
itself is a no-op change to pass the uid information to
AutomaticOnOffKeepaliveTracker.
Bug: 311119352
Test: atest FrameworksNetTests
Change-Id: I7d96e7a0d3f3054d1409de350420a24378b28cdb
SysUi needs to see connectivity diagnostic callbacks to display
"Checking for internet access..." -> "Connected" or "No internet access".
Bug: 307161342
Test: atest FrameworksNetTests, manually connect to a network without internet connectivity,
verify Internet Dialog doesn't get stuck showing
"Checking for internet access..."
Change-Id: I86e2b852ff9e5dfbfc37ba711f477166b0ac6835
Quang Anh Luongcommited 2023-11-15 11:06:42 +09:00
Currently, BatteryStatsService register netd callback and track radio
power state only for the default network.
So, battery stats are not accurate if cellular and Wi-Fi networks are
active at the same time.
aosp/2561090 updates BatteryStatsService not to register netd callback
on V+ devices.
This CL updates LegacyNetworkActivityTracker to call BatteryStats API
and update radio power state for networks including non default networks
on V+ devices.
Bug: 267870186
Bug: 279380356
Test: atest FrameworksNetTests
Change-Id: I826b3b4046cc7b8aef46c13300854eaf14b1b777
on V+ devices, NetworkActivityTracker adds idleTimer when the network is
first connected and removes idleTimer when the network is disconnected
so that activity tracker can receive netd
onInterfaceClassActivityChanged callback for multiple networks.
Bug: 267870186
Bug: 279380356
Test: atest FrameworksNetTests
Change-Id: I6f3a95c27e3e58f3f60c40065f562d00431a56b1
Following CL adds idleTimer for multiple networks and track activities
including non default network on V+
Current LegacyNetworkActivityTracker uses transport type as an idleTimer
label but this makes it difficult to have multiple idleTimers.
So, this CL updates LegacyNetworkActivityTracker to support using netId
as an idleTimer label.
Bug: 267870186
Bug: 279380356
Test: atest FrameworksNetTests
Change-Id: I0039f5624ae1d142dbacba53aa90ca9bf6d43599
A new firewall chain is needed to configure background network
restrictions for apps.
This change only adds the API stubs and traffic controller constants to
make the chain work. Policy changes using this chain will follow in
the framework code.
Test: atest CtsNetTestCases:ConnectivityManagerTest
Test: atest ConnectivityServiceTest
NO_IFTTT=The Lint rule along with the relevant code in Common.h is
being deleted in aosp/2819759
Bug: 304347838
Change-Id: I33e2db6671431f7c576fc931d9f96e684fc1e78a
Also add some toString() methods that were useful in debugging.
Test: new test in CSLocalAgentTests
Change-Id: Ife95815e39d92bbef84b1c5ea75a151882590d09
Avoid network agents trying to do things that the stack
does not support.
Test: new test in this change
Change-Id: I3ffa1c3ddbb0b648b06862dc0a44f8525d358acc