Commit graph android_packages_modules_Co.../service/src/com/android/server/ConnectivityService.java
Message SHA1
Firewall: Transport-based toggle support (3/3)
Using policies provided by NetworkPolicyManagerService (fw/b), allow
or disallow an app to access a network based on network transport
type, e.g. Wi-Fi or Cellular.

Needs corresponding fw/b and netd changes.

All networks are treated as being restricted, and only UIDs whose
policy allows them on a transport are able to route outgoing traffic
over a network of that type. In addition, to prevent incoming traffic
to UIDs that are not allowed on the active network, and to handle UIDs
that have a policy which prevents them from accessing VPNs, UIDs that
are not allowed to access their active network are added to a denylist
that prevents them from accessing networks in general. Networks which
are truly restricted, however, such as for IMS, are left unchanged.

Also includes squashed changes:

Author: Tommy Webb <tommy@calyxinstitute.org>
Date:   Thu Apr 27 15:51:18 2023 -0400

    fixup! Set allowed UIDs for networks based on policies

    Revert to prior network permission behavior here, and make necessary
    changes in netd instead. This improves clarity and allows UIDs to
    take advantage of default network rules which would otherwise
    require system-level permission, prior to this change.

    Related: Icd64aa530e8d202abb97d8325160a5d4c0b4c490
    Change-Id: If5493deb96f88fe3ff5fc8a6a0c6d6d9bc77eff4

Author: Tommy Webb <tommy@calyxinstitute.org>
Date:   Wed Mar 22 09:05:18 2023 -0400

    Expose new isUidCurrentlyDisallowedByPolicy

    Allows determining if a UID is blocked based on its transports.

    Change-Id: I2729b61c349ec2812a74d7d1c04b90a58b0f5b88

Author: Tommy Webb <tommy@calyxinstitute.org>
Date:   Wed Sep 20 15:19:45 2023 -0400

    Use framework listener for allowed transports

    When allowed transports change, instead of exposing an API from
    Connectivity that the framework calls, add a new method to the
    framework's NetworkPolicyCallback that we override.

    This change benefits the prebuilt mainline module, preventing
    the need to fight with the platform to add new module APIs.

    Requires fw/b change of the same Change-Id.

    Change-Id: Ie476f23684b00397197184e965201d6823b28de2

Author: Tommy Webb <tommy@calyxinstitute.org>
Date:   Wed Sep 20 16:10:36 2023 -0400

    Notify the framework about denylist changes

    When the denylist changes, instead of exposing an API from
    Connectivity that the framework calls, add a new method to the
    framework's NetworkPolicyManager that we call to inform it of
    this directly.

    This change benefits the prebuilt mainline module, preventing
    the need to fight with the platform to add new module APIs.

    Requires fw/b change of the same Change-Id.

    Change-Id: I3c3593f110753a3ce02af3739f600190f22e9663

Author: Tommy Webb <tommy@calyxinstitute.org>
Date:   Fri Dec 6 08:10:27 2024 -0500

    fixup! Firewall: Transport-based toggle support (3/3)

    Use a dedicated callback for allowed transports, in preparation for the
    removal of NetworkPolicyCallback.

    Change-Id: I9e00948bdc06e3a1beb14b5b9b9ab3eb15b9a528

Change-Id: I79342edbec92090cca20853ba50ea7fd48ec81c2

Tommy Webb   authored and   Thomas Turner   commited 2025-08-25 10:44:30 +01:00
4cc9665748
Fix a bug where non-VPN networks would update VPN uids.
Previously, non VPNs would not be created when updateVpnUids()
is called inside handleRegisterNetworkAgent. Because the network
is not created, netd would refuse to set the UIDs with an error.
Now that networks are created immediately with the
QUEUE_NETWORK_AGENT_EVENTS_IN_SYSTEM_SERVER flag,
the network is created and netd does set the UID for any
network as if they were a VPN. This results in the UID having
the wrong default network, which in turns prevents it from
accessing Internet.

Test: new test in this patch
Bug: 408717088
Flag: EXEMPT bugfix
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:97e690169779f9790aa8d6026fca6bdc3d61e1b3)
Merged-In: If68ea7d60919c0c7e177480f6167196381e00f35
Change-Id: If68ea7d60919c0c7e177480f6167196381e00f35

Chalard Jean   authored and   Android Build Coastguard Worker   commited 2025-04-15 16:36:05 -07:00
409913a215
Merge "Only apply the early network agent creation on B" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-21 09:27:23 -07:00
4e2efc94f5
Merge "Disable non-thread local network matching" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-21 08:08:56 -07:00
e0051cdeb9
Disable non-thread local network matching
Currently, apps targeting V can see thread local network.

This change introduces a mechanism to make existing
apps unable to see non-thread local networks to ensure minimal
impact on existing devices and applications while adopting this
behavior. Apps targeting B+ Sdk and run on V+ devices can see
non-thread local networks.

Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.CSLocalAgentTests \
      --update-device
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server --update-device
      (on next/trunk_staging release config)
Bug: 349487600
Change-Id: I6aa43cebc20a9017c2d8a8a90ebb1d53040a27bb

Junyu Lai   commited 2025-03-21 19:34:49 +08:00
0b806fd931
Only apply the early network agent creation on B
...and if the feature is not killed.

For devices on V and below, this feature should be subject
to a rollout. That rollout should be done in mainline beta
if possible at all, meaning the flags can be defined later.

If beta isn't possible after all, a legacy rollout can happen
starting in M2025-06 too.

Test: manual
Change-Id: I941762bf759ce25b4bd1f908e971ceaf4f49f671

Chalard Jean   commited 2025-03-21 19:29:07 +09:00
3d0e3121d9
Reapply "Immediately create networks unless chickened out"
Now that the faulty test is fixed,
This reverts commit 0141d82c2d.

Test: ConnectivityCoverageTests CtsNetTestCases FrameworksTelephonyTests
Change-Id: Ic9fee5bb7efb8ca4c05d7c9e600236186d094080

Chalard Jean   commited 2025-03-21 14:57:25 +09:00
324365a901
Reapply "Always disconnect agents immediately."
Now that the faulty test is fixed,
This reverts commit 19dcc447c4.

Test: ConnectivityCoverageTests CtsNetTestCases FrameworksTelephonyTests
Change-Id: I30fa35cef1729e6ecd4140c52fabfa2da1a9bb4b

Chalard Jean   commited 2025-03-21 14:57:25 +09:00
9fdc988dc8
Reapply "Make iterating over mNetworkAgentInfos safer."
Now that the faulty test is fixed,
This reverts commit 09bc78fda7.

Test: ConnectivityCoverageTests CtsNetTestCases FrameworksTelephonyTests
Change-Id: If52cc211b7859c0add07c16f171a6ce342ccca97

Chalard Jean   commited 2025-03-21 14:57:25 +09:00
2f52a0e86d
Merge changes from topic "revert-3548747-TOVIIQGWFJ" into main
* changes:
  Revert "Make iterating over mNetworkAgentInfos safer."
  Revert "Always disconnect agents immediately."
  Revert "Immediately create networks unless chickened out"

ESWAR MAGATAPALLI (xWF)   authored and   Gerrit Code Review   commited 2025-03-20 00:52:25 -07:00
5a3a51eb7a
LocalNet: remove buggy getIpv4MappedAddressBitLen()
(a) this function returns a constant

(b) this function is utterly misnamed/documented:

an ipv4 mapped address is (like any ipv6 address) 128 bits long

(c) there's not even a guarantee the address is v4 mapped
when it is called

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

Maciej Å»enczykowski   commited 2025-03-19 22:03:50 -07:00
0c42bc4bef
LocalNet: add DNS over TLS exception
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie780a191002f17a8b2b049271bd6c48d9af4c4fd

Maciej Å»enczykowski   commited 2025-03-19 21:25:17 -07:00
f236e862a9
Revert "Make iterating over mNetworkAgentInfos safer."
Revert submission 3548747

Reason for revert: Droidmonitor created revert due to b/404956859. Will be verified through ABTD for standard investigation.

Reverted changes: /q/submissionid:3548747

Change-Id: I0c0b2724666cf6dfddbe3633fd50454f003ed133

Satish Yalla   commited 2025-03-19 20:18:37 -07:00
09bc78fda7
Revert "Always disconnect agents immediately."
Revert submission 3548747

Reason for revert: Droidmonitor created revert due to b/404956859. Will be verified through ABTD for standard investigation.

Reverted changes: /q/submissionid:3548747

Change-Id: I44affb742ca066406e93fc75056b4d3d1298eadb

Satish Yalla   commited 2025-03-19 20:18:37 -07:00
19dcc447c4
Revert "Immediately create networks unless chickened out"
Revert submission 3548747

Reason for revert: Droidmonitor created revert due to b/404956859. Will be verified through ABTD for standard investigation.

Reverted changes: /q/submissionid:3548747

Change-Id: Ic4226f2f1a20965f80b554967568a4450e460da2

Satish Yalla   authored and   Gerrit Code Review   commited 2025-03-19 20:18:37 -07:00
0141d82c2d
Immediately create networks unless chickened out
Test: ConnectivityCoverageTests CtsNetTestCases
Change-Id: I65763a528fb2cc04700ac8468eeca762b9eb01b5

Chalard Jean   commited 2025-03-19 21:03:23 +09:00
a13e335983
Always disconnect agents immediately.
This relands aosp/2623893 now that the underlying timing
issues have been fixed. It also addresses the two outstanding
comments that had not been fixed. It conditions it on the
"queue in system server" feature.

Currently, various codepaths in ConnectivityService disconnect
networks using NetworkAgentInfo#disconnect. This posts a message
to the NetworkAgent to disconnect and also posts a message to
ConnectivityService to call disconnectAndDestroyNetwork, which
performs all cleanup in ConnectivityService. These two messages
race and the order is non-deterministic.

Instead, always disconnect using disconnectAndDestroyNetwork,
and have disconnectAndDestroyNetwork post the message to the
agent to disconnect.

This fixes a bug where if wifi uses unregisterAfterReplacement
twice in quick succession, when the third agent connects it
doesn't work because the interface is still being used by the
second network.

Bug: 286649301
Test: covered by existing tests
Change-Id: Ib1d77da39232c02060a7a7c016ffd3a969e2356d

Lorenzo Colitti   authored and   Chalard Jean   commited 2025-03-19 21:03:23 +09:00
0e9f5e626b
Make iterating over mNetworkAgentInfos safer.
This CL provides convenience methods to iterate over all
networks.
- forEachNetworkAgentInfo takes a consumer and runs it on all
  networks in mNetworkAgentInfos. The consumer is allowed to
  remove any number of networks. This is needed because some
  loops over mNetworkAgentInfos result in disconnecting networks,
  which removes them from the set.
- anyNetworkAgentInfo takes a predicate and returns true iff it
  returns true on any element in mNetworkAgentInfos. The
  predicate is not allowed to modify the set in any way.

Bug: 288149251
Test: simple refactor, covered by existing unit tests
Change-Id: I5d8b38503895d33abc2d96daaa1c96372befce64

Chalard Jean   commited 2025-03-19 21:03:22 +09:00
ede14bde88
Process enqueued messages from the NAI synchronously.
As ConnectivityService is ready to accept messages about a network
agent, it should process messages immediately and before messages
from other agents are processed.

This is because of minute ordering issues between the agent process,
ConnectivityService and the network stack. In particular, as the agent
is created, ConnectivityService requests the NetworkMonitor from the
network stack ; while this is happening, the process creating the
agent may have sent a bunch of other messages... including, but not
limited to, disconnects or creation of other agents.

The operative case is the case where a disconnect is in the queue.

agent1.register
    → CS creates the monitor for agent 1
agent1.unregisterAfterReplacement
    → CS enqueues in agent1 pending creation of the monitor
agent2.register
    → CS creates the monitor for agent 2
monitor for agent 1 is created
    → CS posts a message to complete agent 1 creation
monitor for agent 2 is created
    → CS posts a message to complete agent 2 creation
agent 1 creation completes
    → CS re-posts the unregisterAfterReplacement message
agent 2 creation completes
...and this is where things fail, because unregistering agent 1
isn't processed yet. If they use the same interface (which is
a common use case for unregisterAfterReplacement) then this
creation will fail.

To address this, this patch will process all agent1 messages
synchronously as the creation completes. It will solve the case
above, and it passes all tests for early network creation.

However, it is worth noting that this is not actually correct,
because it does not guarantee that all messages are processed
in order. Namely, two agents have separate queues and
therefore if they send interleaved messages while CS is
waiting for the NetworkMonitor to be created, the order of
these messages will be lost. e.g.

agent1.register
agent2.register
agent1.unregisterAfterReplacement

The case above SHOULD fail if the agents have the same
interface, but with this patch it will likely succeed because
the call to agent1.unregisterAfterReplacement will be received
while the two NetworkMonitor are being created, and then
be processed as agent1 finishes registration.

The correct change, therefore, would really enqueue all
messages when *any* agent (of the same process at least)
is being created. However, it is arguable whether it's worth
building that change over this one, and it is even arguable
whether the behavior of this here change might not be
better, insofar as two agent messages are generally
unrelated to each other except for unregistering.

Test: CtsNetTestCases ConnectivityCoverageTests
Change-Id: Idf75e4e96c67a456cf0979a79321603b46e8c99c

Chalard Jean   commited 2025-03-18 19:23:58 +09:00
c2cf5ea823
Remove the queue on the NetworkAgent side
Now that the system server has a queue doing this job,
the queue on the network agent side can be removed.

Test: ConnectivityCoverageTests, CtsNetTestCases
Change-Id: Idf0435f447cfdd28d829a867d1085771837c6f9b

Chalard Jean   commited 2025-03-18 19:23:57 +09:00
391ec5d99c
Merge changes I71abf9d0,I57f25f5e,If6b15419 into main
* changes:
  Reapply "Add a queue system server-side for NetworkAgent"
  Reapply "Unify registration and NM assignment in NAI"
  Reapply "Return the registry in registerNetworkAgent."

Jean Chalard   authored and   Gerrit Code Review   commited 2025-03-18 03:19:07 -07:00
6f2b294fd0
Merge changes from topic "vpn-type-oem-enterprise" into main
* changes:
  Treat new OEM VPN types like the corresponding non-OEM types.
  Add more NativeVpnType AIDL constants for OEM-specific VPNs.

Lorenzo Colitti   authored and   Gerrit Code Review   commited 2025-03-18 00:50:13 -07:00
944a1d2855
Reapply "Add a queue system server-side for NetworkAgent"
Now that faulty Telephony tests have been disabled temporarily
to allow for this bugfix, this can be reverted.
This reverts commit a5ec9b4112.

Test: FrameworksTelephonyTests CtsNetTestCases
Change-Id: I71abf9d02bdd34a4de80157a3f42bdfee6f6617e

Chalard Jean   commited 2025-03-18 14:42:54 +09:00
3c040009c5
Reapply "Unify registration and NM assignment in NAI"
Now that faulty Telephony tests have been disabled temporarily
to allow for this bugfix, this can be reverted.
This reverts commit 30fcf820f9.

Test: FrameworksTelephonyTests CtsNetTestCases
Change-Id: I57f25f5e6481106255df0ab69558e351eb938f68

Chalard Jean   commited 2025-03-18 14:42:50 +09:00
b3a53d0d39
Reapply "Return the registry in registerNetworkAgent."
Now that faulty Telephony tests have been disabled temporarily
to allow for this bugfix, this can be reverted.
This reverts commit 653d5f1ef4.

Test: FrameworksTelephonyTests CtsNetTestCases
Change-Id: If6b1541981803dc84de57b48adb13d40c9997fa0

Chalard Jean   commited 2025-03-18 14:42:39 +09:00
8a97692638
Treat new OEM VPN types like the corresponding non-OEM types.
Bug: 389829981
Test: new CTS tests
Change-Id: I9455a1e00db6fdca3706e83e26daa60db6c73d09

Lorenzo Colitti   commited 2025-03-18 14:34:18 +09:00
fd89cf529a
Merge changes from topic "revert-3535182-EBVRAQTHFS" into main
* changes:
  Revert "Return the registry in registerNetworkAgent."
  Revert "Unify registration and NM assignment in NAI"
  Revert "Add a queue system server-side for NetworkAgent"

Pechetty Sravani (xWF)   authored and   Gerrit Code Review   commited 2025-03-17 02:23:26 -07:00
67cc745550
Revert "Return the registry in registerNetworkAgent."
Revert submission 3535182

Reason for revert: <Droidmonitor created revert due to b/404070202.Will be verified through ABTD for standard investigation.>

Reverted changes: /q/submissionid:3535182

Change-Id: I2febd2ee7227d487d9cd69dcabd9c04f888fd2de

Pechetty Sravani (xWF)   commited 2025-03-17 00:48:05 -07:00
653d5f1ef4
Revert "Unify registration and NM assignment in NAI"
Revert submission 3535182

Reason for revert: <Droidmonitor created revert due to b/404070202.Will be verified through ABTD for standard investigation.>

Reverted changes: /q/submissionid:3535182

Change-Id: I65fdaaacb56c8ef227eaf1a0193efe8d332d6473

Pechetty Sravani (xWF)   commited 2025-03-17 00:48:05 -07:00
30fcf820f9
Revert "Add a queue system server-side for NetworkAgent"
Revert submission 3535182

Reason for revert: <Droidmonitor created revert due to b/404070202.Will be verified through ABTD for standard investigation.>

Reverted changes: /q/submissionid:3535182

Change-Id: Id48ef1cf44911cb291bcd8db349934751297718b

Pechetty Sravani (xWF)   authored and   Gerrit Code Review   commited 2025-03-17 00:48:05 -07:00
a5ec9b4112
Merge changes I4bc29b10,I94a56b2b,I9ca025b1 into main
* changes:
  Add a queue system server-side for NetworkAgent
  Unify registration and NM assignment in NAI
  Return the registry in registerNetworkAgent.

Jean Chalard   authored and   Gerrit Code Review   commited 2025-03-16 15:57:51 -07:00
f04de0efc1
Add a queue system server-side for NetworkAgent
The intent is to remove the queue on the NetworkAgent side.
This queue is triggered with the same conditions as the
existing one.

Test: ConnectivityCoverageTests, CtsNetTests
Change-Id: I4bc29b10e48e13cdf3c3a8a15a7c8d15954d2457

Chalard Jean   commited 2025-03-14 13:23:50 +09:00
34ccc71462
Unify registration and NM assignment in NAI
Registration is marked by the creation of the network monitor
for a given network agent. This patch makes this fact much
more ovbious.

Test: CtsNetTests ConnectivityCoverageTests
Change-Id: I94a56b2bce6f453322b1eb91d6a6f14b31e7a95f

Chalard Jean   commited 2025-03-14 13:23:50 +09:00
2e2f5faecd
Return the registry in registerNetworkAgent.
This is a resubmit of
I0fd90716b9f5501bdcdc7ee5165321737a0076ae
which did not account for testing of this private method
in Telephony tests.

Also make the network agent registry two way to eliminate
reordering possibilities.

Test: ConnectivityCoverageTest, CtsNetTests
Change-Id: I9ca025b1369dcb1202f906d5cff79e3d935b40da

Chalard Jean   commited 2025-03-14 13:23:50 +09:00
80d4326d76
Creating interface name to index tracking for Bpf Maps.
Adding mechanism to track interaface name to interface index, this map
would be used by BpfNetMaps for storing interface index.

Bug: 400681214
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.InterfaceTrackerTest
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.BpfNetMapsTest
Change-Id: I2a65cac908d9c4d10714e3fe26be20322d4a1db3

Sarup Dalwani   commited 2025-03-13 17:04:54 +00:00
53ecd95072
Revert "Return the registry in registerNetworkAgent."
This reverts commit 70ede3260c.

Reason for revert: Likely culprit for b/402365566 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.

Change-Id: If72cc264c5e505348309c6c11dbbfd11adeaf31b

Chaitanya Cheemala (xWF)   authored and   Gerrit Code Review   commited 2025-03-11 06:05:49 -07:00
846fb39e8a
Return the registry in registerNetworkAgent.
Also make the network agent registry two way to eliminate
reordering possibilities.

Test: ConnectivityCoverageTest, CtsNetTests
Change-Id: I0fd90716b9f5501bdcdc7ee5165321737a0076ae

Chalard Jean   commited 2025-03-11 16:26:17 +09:00
70ede3260c
Merge "Enable early native network creation for local network" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-09 20:53:11 -07:00
daa1f52b02
Enable early native network creation for local network
This is needed by tethering local network feature, given that
the IpServer needs to setup forwarding after native network
creation and before signaling network availability.

Test: atest CtsNetTestCases:android.net.cts.NetworkAgentTest \
      ConnectivityCoverageTests:android.net.EthernetTetheringTest \
      ConnectivityCoverageTests:android.net.connectivity.com.android.server.ConnectivityServiceTest \
      --update-device
Bug: 349487600
Change-Id: I2bc2ec355e01be661b587406bd127dff11665047

Junyu Lai   commited 2025-03-10 10:31:11 +08:00
91ef9d38e3
Merge "Fix wrong condition for blocked status tracking wtf log" into main
Motomu Utsumi   authored and   Gerrit Code Review   commited 2025-03-09 16:44:22 -07:00
f498a21182
Merge "Adding more test cases for stacked link properties for local network." into main
Sarup Dalwani   authored and   Gerrit Code Review   commited 2025-03-01 10:03:31 -08:00
9de6f57d2d
Merge "Fix : crash ConnectivityService when PendingIntent is canceled" into main
Jean Chalard   authored and   Gerrit Code Review   commited 2025-02-26 22:17:11 -08:00
5c909394a6
Fix : crash ConnectivityService when PendingIntent is canceled
PendingIntent.send will throw CanceledException when the intent
can't be sent, because it was canceled or some other reason. In
some, but not all of these cases, it will still call onSendFinished
after the send is done. This means there is no way to be sure
to do something exactly once after the intent is sent.

Unfortunately, ConnectivityService must keep a wakelock until
sent is finished, and wakelocks must be released exactly once.
Too bad.

The simplest solution is to create a specialized listener object
that can manage the lifecycle of the wakelock. This allows
very localized code, easy review and checking, cheap thread
safety, and not creating multiple locks. It also avoids the
ConnectivityService class implementing OnFinished itself,
which is arguably not very readable considering how big
the class is.

Test: new test that crashes the system without the patch
Fixes: 390043283
Change-Id: Ice528eddaedb4d663098eb2bb0ae7183dafbc073

Chalard Jean   commited 2025-02-27 11:46:06 +09:00
f34735ebdc
Enable NetworkCallback optimizations by default.
These optimizations are already launched to all public Pixel
devices and were in in 25Q2 beta releases as well. Enable them
by default on all supported releases. The appcompat risk is very
low (these changes are difficult even for an app to detect if
it's looking for them), the user benefits are substantial, and
there is a kill switch if any unforeseen issues do occur.

Bug: 327038794
Test: both codepaths are covered by existing tests
Change-Id: I42c7ceb71ef02d078bf4563744cb11afd412f267

Lorenzo Colitti   commited 2025-02-26 04:24:58 +09:00
2169522878
Adding more test cases for stacked link properties for local network.
Addressing feedback from previous change "Adding stacked link addresses
to local_net_access map" and adding more test cases for impact of
stacked link properties on local network prefixes.

Bug: 369815823
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.BpfNetMapsTest
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.CSLocalNetworkProtectionTest
Change-Id: I4d32d86d3e083a1a14b845583fd80a7a4b18ae5f

Sarup Dalwani   commited 2025-02-20 05:46:02 +00:00
e53faa4e84
Check local network permissions when permission changes, or when user or
packages is added or removed

Bug: 388803658
Test: atest ConnectivityCoverageTests

Change-Id: I7d098c4d9a7614d0bd40ae23869a2010ee3f0779

Jacque Li   authored and   Neha Raj   commited 2025-02-20 04:59:45 +00:00
8d5c6eae80
Merge "Adding stacked link addresses to local_net_access map" into main
Sarup Dalwani   authored and   Gerrit Code Review   commited 2025-02-19 19:01:55 -08:00
c42f5fc47f
Start L2capNetworkProvider in CS
Starts L2capNetworkProvider in ConnectivityService. Alternatively, this
could be moved to ConnectivityServiceInitializer instead in a follow up.

When L2capNetworkProvider is created, it starts a handler thread, so
makeL2capNetworkProvider must return null in tests as otherwise the
thread leaks.

Test: atest NetworkReservationTest
Change-Id: I35c14815b1a71f0739c1bf63ad466763d611434c

Patrick Rohr   commited 2025-02-18 19:19:22 -08:00
611ce3f57c
Adding stacked link addresses to local_net_access map
Iterating over stacked link address to ensure correct mapping for
interface to local network ip prefixes.

Bug: 369815823
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.BpfNetMapsTest
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.CSLocalNetworkProtectionTest
Change-Id: I3b2ed906caf43584ffb0e8041f9302c760099f7b

Sarup Dalwani   commited 2025-02-18 19:30:12 +00:00
7d0fcbb0d3
Exclude dns servers from LNP
Whenever ip interface is updated, we are updating local network
addresses. These may include dns servers that are needed to be excluded from
restrictions.

Bug : 393354879
Test: Manually and atest
ConnectivityCoverageTests:android.net.connectivity.com.android.server.CSBpfNetMapsTest

Change-Id: Id4ebb33ab7de84ac1c81d485e599779c460bacdc

Neha Raj   commited 2025-02-18 03:28:42 +00:00
4792cc5d98