* changes:
Add missing javadocs to satisfy linter
Make linter happy
Use ThreadLeakMonitor for CSL2capProviderTest
Add some tests to ensure BluetoothExceptions are handled
Move creating L2capPacketForwarder to dependencies
Patrick Rohrauthored and Gerrit Code Reviewcommited 2025-02-21 15:04:40 -08:00
This CL introduces ThreadLeakMonitor for CSL2capProviderTest.
ThreadLeakMonitor ignores threads with unique names, so all
L2capNetworkProvider related threads must specify a name.
Test: TH
Change-Id: I7cfcc93ab562a1ada2058d8c73e968a8d0005b1d
This is just the beginning.
Also fixed a bug that put(null) on the blocking queue, which apparently
is not supported.
Test: TH
Change-Id: I26f6669f483d76fcba83735bb6d32880e23dd451
This is a no-op refactoring (except for logging) in preparation for an
upcoming CL(aosp/3502915) that will use SkDestroyListener to close quic
connections for destroyed quic sockets.
Test: atest FrameworksNetTests
Bug: 311792075
Change-Id: I41e2a16075fc9242cae19f84d1255358333744ab
* changes:
Fix test comment
Enable header compression when requested
Implement 6lowpan header compression
Add a basic CSTest for L2capNetworkProvider
Release network reservations in tearDown
Start L2capNetworkProvider in CS
Revert "Join HandlerThread if BLE is not supported"
Maciej Żenczykowskiauthored and Gerrit Code Reviewcommited 2025-02-18 21:39:41 -08:00
This implements 6lowpan header compression per rfc 6282. While the
decompression logic is full-fledged (to accept almost any 6lowpan
compressed packet on ingress), the compression logic does *not* actually
compress the packet.
Fully fledged compression might be submitted in a follow up, to make
integration testing possible.
Test: TH
Change-Id: I5ea98a06e502fe0752cfe827dbdf8ee4a7dfb24c
This moves the tests that used to be in L2capNetworkProviderTest into a
CSTest based CSL2capProviderTest; however, it still only tests that
reservation offers are created in response to reservation requests.
More thorough tests will be added in follow ups.
Test: TH
Change-Id: I0b243f4517ee41376716cf4930f90657c4bc77b0
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
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
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
Whenever LinkProperties is added/modified/removes, we are updating local
network prefixes for the modified interface/addresses. These prefixes
are used by BPF egress and ingress cgroup hooks to disallow local
network packets if the calling application do not have required
permission.
Bug: 369815823
Test: Manually tested
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.BpfNetMapsTest
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.CSLocalNetworkProtectionTest
Change-Id: Ie592ecb948ae05a0a73f47d0573560eb705f6bcf
* changes:
Check whether a NetworkRequest is already tracked
Check whether client NetworkRequest includes a valid specifier
Add empty ClientOffer
Delete L2capNetworkProviderTest
Add support for an L2CAP server network
Patrick Rohrauthored and Gerrit Code Reviewcommited 2025-02-14 15:10:29 -08:00
To add PERMISSION_SDKSANDBOX_LOCALHOST which is used in the same bitmask
as permissions declared in INetd.aidl but doesn't need visibility to the
platform.
Bug: b/326383676
Test: NetworkTrafficPermsTest
Flag: N/A
Change-Id: Id7a36f5659f8fd7542a87671d4b5f067d66db34e
This commit excludes Google Cast app subtypes from mDNS offloading. The
large number of subtypes would consume excessive firmware resources if
offloaded.
Test: TH
Change-Id: I562a94187dc5c710ca37d4997e9ed6c1602918b6
This change creates an AcceptThread inside ReservedServerOffer which
accepts all incoming L2CAP connections and creates an L2capNetwork for
each of them.
Note that these networks are indistinguishable, so CS will tear all but
the first one down. This is working as intended.
If the L2capNetwork or the AcceptThread encounter any error during
execution, the reserved offer is torn down and the reserving app will
receive an onUnavailable() callback (by virtue of reservation
semantics).
Test: atest NetworkReservationTest
Change-Id: I49d078fb32ff48c1201a8a4dc65cbe785dcc9179
The MdnsDiscoveryManagerTests#testDiscoveryExecutor test is flaky
because the Future task sometimes fails to complete on the CF
target. This performance-dependent issue causes Future#isDone to
return a false value. Therefore, remove the isDone check, as
Future#get already performs the same check.
Bug: 392995312
Test: atest MdnsDiscoveryManagerTests#testDiscoveryExecutor \
--iteration 100
Change-Id: I6a032e80da76eae5ec81bfe7900c0b0e3a3c6efa
* changes:
Move reserved offer teardown into a function
Store reserved offers in a Set instead
Allocate a BluetoothServerSocket for the ReservedServerOffer
Maciej Żenczykowskiauthored and Gerrit Code Reviewcommited 2025-02-10 16:54:47 -08:00
* changes:
Move L2capNetworkProvider#start() onto Handler thread
Mark globals as private
Move the common set of NetworkCapabilities to the provider class
Add L2capNetwork class
Maciej Żenczykowskiauthored and Gerrit Code Reviewcommited 2025-02-10 14:44:22 -08:00
This change allocates a BluetoothServerSocket as a response to the
reservation. The resulting PSM is used to create the reserved
capabilities stored in ReservedServerOffer.
Test: TH
Change-Id: I3e789541474a492bb1c015d6316db12a3c995995
L2capPacketForwarder forwards packets between an L2CAP BluetoothSocket
and a tun fd.
It uses blocking i/o to do so, since the BluetoothSocket API does not
expose a file descriptor to poll() on.
It remains to be seen whether shutdown() on a tun interface fd is
actually implemented. Currently, the test uses a pair of SOCK_SEQPACKET
sockets which require to be shutdown to interrupt the blocking read.
Test: L2capPacketForwarderTest
Change-Id: I03d2a2dd76ec2b71fdb9e3ea7008daa6d1d124fe
Current test was mistakenly added to the unit test version of
ConnectivityManagerTest instead of the CTS test. Move this to the CTS
test instead.
Bug: 392986269
Test: atest android.net.cts.ConnectivityManagerTest
Change-Id: Id64d21929fb6b6c42f46a821a3cd28bbcaf77cda
Quang Anh Luongcommited 2025-02-07 12:42:12 +09:00
When setIncludeTestInterfaces(false) is called, any RTM_DELLINK
callback for a testtap interface is ignored, since the interface is no
longer considered to be a valid ethernet interface.
Change setIncludeTestInterfaces to go through all interfaces, and stop
tracking the ones which are no longer valid. Otherwise, they will
stick around forever (and break subsequent tests).
Bug: 390722214
Test: TH
Change-Id: Ied73e86c0452831f4d6b00f67908c51201af8bbd
While doing some testing for another change (pa/2844131), I noticed that
an interface in config.xml with no network capabilities listed provided
no internet connection. parseEthernetConfig was updated to provide empty
config capabilities with the default capabilities (which
includes NET_CAPABILITY_INTERNET for non test ifaces).
Flag: BUG_FIX
Test: atest ConnectivityCoverageTests
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.ethernet.EthernetTrackerTest
Bug: 352523028
Change-Id: I6f73b0554f95c20fd1912a3c8da2b3c64f2ac4c4
As part of the major tethering refactor to associate every IpServer with
a TetheringRequest, tether()/untether() APIs should be completely
removed in B and all tethering should go through startTethering() (with
the exception of Wifi LOHS and Wifi P2P, which will move to
startTethering() in a future CL).
Bug: 216524590
Test: atest CtsTetheringTests TetheringTests
Change-Id: If7981f1ee7d80ff0a1cc0069ba7a4ebf79144160
Quang Anh Luongcommited 2025-01-15 08:59:42 +09:00
The reserved offer adapts the reservation requests capabilities, and
additionally populates its own capabilities (namely the PSM provided by
the BluetoothServerSocket).
Test: TH
Change-Id: Ida388b6f1e4552242726bd4d7eba6215bb0577a3
Registers a blanket reservation offer which will receive reservation
requests filed using ConnectivityManager#reserveNetwork.
Test: TH
Change-Id: I2d37fe564a6c40f2c6dee1f6f7aa655c47628b85
The network provider is registered when BLE is supported.
Bug: 372936361
Test: L2capNetworkProviderTest
Change-Id: I8163339015f4a3bb0ff8911f6f52a38ec1730f39
A NetworkOffer can be updated by registering a new set of capabilities
and score using an already registered NetworkOfferCallback object.
Since reserved offers are guaranteed to never send more than a single
onReserved() callback, they cannot support updating the capabilities
(not to mention that the reservationId is also part of the
capabilities).
This change changes NetworkOffer migration to only allow reserved offers
to update their NetworkScore. If a reserved offer tries to update its
capabilities, the existing offer is removed and the new offer is
silently rejected. This change does not affect regular offers (with
RES_ID_UNSET) nor blanket offers (with RES_ID_MATCH_ALL_RESERVATIONS).
Test: CSNetworkReservationTest
Change-Id: I872a1dbda209098f08391a7543b9446e1f50d4f0