Commit graph android_packages_modules_Co.../tests/unit/java
Message SHA1
Merge "Rename mXXXNetworkAgent to mXXXAgent"
Jean Chalard   authored and   Gerrit Code Review   commited 2023-01-17 08:12:31 +00:00
76ee573dda
Merge "Remove dev recorder from NetworkStatsService"
Aaron Huang   authored and   Gerrit Code Review   commited 2023-01-17 07:27:35 +00:00
a3ed25924e
Merge "Import CallbackEntries in ConnectivityServiceTest"
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-01-17 07:24:53 +00:00
6366d7c2db
Merge "Create the MdnsDiscoveryManager"
Paul Hu   authored and   Gerrit Code Review   commited 2023-01-17 07:05:13 +00:00
1b81be6de6
Rename mXXXNetworkAgent to mXXXAgent
In the context of ConnectivityServiceTest this is plenty
clear, so terser is better.

Test: ConnectivityServiceTest
Change-Id: Id20afc8a81a6c00c932ffae3b8dbc2919773d35b

Chalard Jean   commited 2023-01-17 14:44:31 +09:00
dda2fd4883
Import CallbackEntries in ConnectivityServiceTest
This is not ambiguous so less verbose is a lot simpler

Test: ConnectivityServiceTest
Change-Id: I47cc689441a20fa5409268e133f9e5ca59216a5d

Chalard Jean   commited 2023-01-17 14:44:29 +09:00
cc231ceed2
Merge changes I3b1ad1be,Id4c2e610
* changes:
  Implement exit announcements
  Implement announcements on probing success

Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2023-01-17 01:36:05 +00:00
fa94865739
Create the MdnsDiscoveryManager
Create the MdnsDiscoveryManager for mdns discovery and resolution
if the feature is enable.

Bug: 254166302
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I4d7591b50cb06f0efcc0dde9834b775c513cceff

Paul Hu   commited 2023-01-17 00:26:01 +08:00
4bd98ef68e
Implement exit announcements
Build ExitAnnouncementInfo in MdnsRecordRepository.exitService. Use a
separate class for AnnouncementInfo and ExitAnnouncementInfo, so
announcement callbacks can differentiate each case.

Bug: 241738458
Test: atest
Change-Id: I3b1ad1bef3dc1514479d7c789ef06b6a7de02e59

Remi NGUYEN VAN   commited 2023-01-16 19:20:36 +09:00
e4bd27f919
Implement announcements on probing success
Once probing succeeds, the advertiser sends announcements for its
records as per RFC6762 8.3.

Implement MdnsRecordRepository.onProbingSucceeded to return the
AnnouncementInfo which will be sent.

Bug: 241738458
Test: atest
Change-Id: Id4c2e610911fdf471a6d6ae08c2127fbf1530dc7

Remi NGUYEN VAN   commited 2023-01-16 17:33:54 +09:00
bdc2d50c49
Merge "Remove *_WILDCARD constants from NetworkTemplate"
Aaron Huang   authored and   Gerrit Code Review   commited 2023-01-16 07:56:09 +00:00
2500069488
Merge "Remove mSubscriberId from NetworkTemplate"
Aaron Huang   authored and   Gerrit Code Review   commited 2023-01-16 07:55:26 +00:00
99348b1664
Merge "Move mDNS code to service-connectivity-t"
Paul Hu   authored and   Gerrit Code Review   commited 2023-01-13 12:33:28 +00:00
2bb41be9d3
Move mDNS code to service-connectivity-t
Instead of using a separate service-mdns library, move the code to
service-connectivity-t.

service-connectivity-t is chosen because it has access to hidden API of
classes that were made updatable in T, such as NsdServiceInfo and
NsdManager. mdns code can be there as it is only loaded on T+.

Bug: 241738458
Test: atest
Change-Id: I7eb6c9ab8bf0e0a614ea2994c6ed80a1a780241f

Paul Hu   commited 2023-01-13 16:42:48 +08:00
03a51d5674
Merge "Cleanup TestableNetworkCallback#assertNoCallback"
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-01-13 07:41:06 +00:00
18967e69f2
Merge "Add unit tests for probing"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2023-01-13 04:05:46 +00:00
73990178e5
Merge "Add MdnsMultinetworkSocketClient"
Paul Hu   authored and   Gerrit Code Review   commited 2023-01-13 03:58:19 +00:00
6ea0c1d05b
Merge "Remove PacketRepeater destinationsSupplier logic"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2023-01-13 01:51:07 +00:00
65df28291a
Add unit tests for probing
Add tests for MdnsRecordRepository and MdnsInterfaceAdvertiser
implementations of probing.

Bug: 241738458
Test: atest
Change-Id: If41a387f14e805e81b6d0d8217d081ca053e340f

Remi NGUYEN VAN   commited 2023-01-12 19:36:43 +09:00
5e5393ffde
Merge "Apply "most-recent" delivery policy to CONNECTIVITY_ACTION."
Jean Chalard   authored and   Gerrit Code Review   commited 2023-01-12 06:37:26 +00:00
526df99b53
Merge "Expose APIs to migrate IpSecTransform"
Yan Yan   authored and   Gerrit Code Review   commited 2023-01-11 18:52:59 +00:00
19aa23db7e
Add MdnsMultinetworkSocketClient
Add MdnsMultinetworkSocketClient which is using for managing
multinetwork for discovery and resolution. If the requests are
specified the network to do the discovery or resolution, it
should send the queries and receive the responses on the active
networks only. This can save the resource by reducing unnecessary
queries and align the behavior with mdnsresponder.

Bug: 254166302
Test: atest FramworksNetTests
Change-Id: I9f49ac11e70cb945f9a90efc5eb684be87801286

Paul Hu   commited 2023-01-12 00:47:46 +08:00
637d9833f8
Remove PacketRepeater destinationsSupplier logic
PacketRepeater can just try to send to both v4 and v6 multicast
addresses, and rely on MdnsReplySender to check whether the sockets have
(automatically) joined the v4 or v6 groups, so there is no need to use
this unusual lambda setup anymore.

Bug: 264947218
Test: atest MdnsProberTest MdnsAnnouncerTest
Change-Id: I09e0fa4bf14e1f31f2d2508f17e23adf1415feb7

Remi NGUYEN VAN   commited 2023-01-11 18:47:35 +09:00
49ae3f0d51
Merge "Enterprise slicing for profile blocking default"
Junyu Lai   authored and   Gerrit Code Review   commited 2023-01-11 07:23:58 +00:00
73bf06f6b5
Merge "Add MdnsAdvertiser"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2023-01-11 05:45:32 +00:00
125ff06cba
Enterprise slicing for profile blocking default
Test: atest ConnectivityServiceTest#testProfileNetworkPreferenceBlocking_networkChanges \
      ConnectivityServiceTest#testProfileNetworkPreferenceBlocking_changePreference \
      --rerun-until-failure 100
Bug: 263219497

Change-Id: Idbda582542bcabf0156e2bab9f8bea42fc908cae

Junyu Lai   commited 2023-01-11 10:47:00 +08:00
35665cc887
Expose APIs to migrate IpSecTransform
This commit exposes APIs to migrate a tunnel mode transform to
new source/destination addresses, as required by MOBIKE.

By calling the exposed API, the caller only caches the new
address in the transform. To complete the migration, caller
MUST apply the tranform to the appropriate tunnel.

This API design is mainly based on the kernel interface and use
cases. The Linux kernel requires Android to provide both the
IpSecTransform and the IpSecTunnelInterface to perform the
migration. And in most cases those two instances are managed
by different entities: IpSecTranform is managed by the key
exchange protocol (e.g. IKE) and IpSecTunnelInterface is managed by
the security tunnel provider (e.g. VPN, VCN, and IWLAN). Thus the
migration process has been designed to have two steps where the
key exchange protocol negotiates and caches the new address,
passes out the updated transform, and the security tunnel
provider applies the transform to a tunnel.

Another benefit of this API is it can also apply to the case
where the network peer does not support MOBIKE and thus cannot
update the existing transforms. In this case, the key exchange
protocol can create a new transform and give it to the security
tunnel provider, and the tunnel provider can still call "apply"
to perform migration without needing to know the details of the
transform update process.

Bug: 169171001
Test: atest FrameworksNetTests, IpSecManagerTunnelTest
Change-Id: I0658cdb09fb31f7e0fb9d0b07f37c2b72b6e705f

Yan Yan   commited 2023-01-10 19:09:05 +00:00
81c2160a63
Add MdnsAdvertiser
MdnsAdvertiser takes requests to advertise services on given Networks,
and relays them to internal maps of MdnsInterfaceAdvertisers.
SocketProvider is used to create the sockets for the requested networks.

It also ensures that added services do not have name conflicts, as
registration of one service should use the same name on all interfaces,
so any conflict means that every MdnsInterfaceAdvertiser needs to use a
different name. Names are automatically updated with a number suffix
(like "service (2)", "service (3)"), similarly to the legacy
mdnsresponder implementation.

The implementatio of MdnsInterfaceAdvertiser will be added in a
different change.

Bug: 241738458
Test: atest

Change-Id: I21aa93c681dd179b9d6ec425bc0f247a10ba5b0b

Remi NGUYEN VAN   commited 2023-01-10 22:04:05 +09:00
314db00b3f
Apply "most-recent" delivery policy to CONNECTIVITY_ACTION.
This allows us to skip any older CONNECTIVITY_ACTION broadcasts
waiting to be delivered when a new broadcast is dispatched.

Bug: 255545931
Test: TH
Change-Id: Iac5da2f727e295d1775bfe91358900f316258be4

Sudheer Shanka   commited 2023-01-09 03:21:44 +00:00
2453a3ada2
Cleanup TestableNetworkCallback#assertNoCallback
Test: FrameworksNetTests
      CtsNetTestCases
      FrameworksNetIntegrationTests
      NetworkStackTests
      NetworkStaticLibTests
      TetheringTests
      MtsTetheringTestLatestSdk
      TetheringIntegrationTest
Change-Id: I2d585d628648cae6fa503145f2f0ded77f982605

Chalard Jean   commited 2023-01-06 16:50:25 +09:00
0b1720af1e
Merge "Rename isStrictMode to better names"
Jean Chalard   authored and   Gerrit Code Review   commited 2023-01-06 06:14:26 +00:00
a8e13ec811
Remove dev recorder from NetworkStatsService
In the original design that using qtaguid module to get the
stats, mDevRecorder was for interface-level summary which
may include non IP layer traffic and mXtRecorder was for
interface-level summary which is only IP layer traffic.

It's migrated to use xt_bpf to read ifaces stats currently
since the qtaguid proc file is no longer exist. Both
readNetworkStatsSummaryXt() and readNetworkStatsSummaryDev()
return stats from bpf iface stats map. mDevRecorder has the
same content as mXtRecorder, and there's no usage actually
reference to mDevRecorder. Thus mDevRecorder can be removed.

Bug: 241880278
Test: FrameworksNetTests
      CtsNetTestCases
Change-Id: Ib0fe823517c81989ee01dc8835ab69a9da818162

Aaron Huang   commited 2022-12-28 23:43:12 +08:00
2e18f3ed8f
Remove *_WILDCARD constants from NetworkTemplate
NetworkTemplate was moved into mainline module and
provide Builder for external users to build template.
MATCH_MOBILE_WILDCARD and MATCH_WIFI_WILDCARD are not
exposed so currently the usage of these two constants
only in module. This change is to remove the constants.

After removing the constants, two methods matchesWifi
and matchesMobile are changed to adapt the original
matches[Wifi|Mobile]Wildcard behavior.

Bug: 238843364
Test: FrameworksNetTests
Change-Id: I9e156b504ce4eb903b39279e443fad27bc921186

Aaron Huang   commited 2022-12-28 18:49:37 +08:00
ece181997c
Remove mSubscriberId from NetworkTemplate
Currently NetworkTemplate provides Builder for users to build a
template and it supports multiple subscriber ids. The mSubscriberId
is a local variable in current design so it can be removed from
NetworkTemplate and also can be removed from the parameter of a
constructor as long as the constructor is not annotated with
@UnsupportedAppUsage.

Bug: 238843364
Test: build, FrameworksNetTests
      CtsNetTestCases
Change-Id: Ic6a695e1c1719111bf26ba905a38673952a24736

Aaron Huang   commited 2022-12-28 12:09:21 +08:00
ee23c03121
Remove mSubscriberIdMatchRule from NetworkTemplate
Currently, mSubscriberIdMatchRule is only used in NetworkTemplate
and it depends on if mMatchSubscriberIds is empty or not. Thus,
remove it since is not really necessary and replace it with
checking matchSubscriberIds if needed.

Bug: 238843364
Test: build, FrameworksNetTests
      CtsNetTestCases
Change-Id: Ic66d2ff2826846778b004bb15a4718a62fa1f470

Aaron Huang   commited 2022-12-28 12:09:09 +08:00
4854d055bb
Merge changes I3dd45b29,Ic177015f
* changes:
  Require IPSEC_TUNNEL_MIGRATION feature flag to migrate transforms
  Support IPsec transform migration

Yan Yan   authored and   Gerrit Code Review   commited 2022-12-22 19:22:46 +00:00
67c7cd81a7
Rename isStrictMode to better names
"isStrictMode" is a poor name to set whether the private DNS
probe succeeded.

Test: ConnectivityServiceTest
Change-Id: I5d0d7ebabc5791b4b6cb7c1cce54b515d2e7e9d9

Chalard Jean   authored and   Jean Chalard   commited 2022-12-22 08:25:16 +00:00
d8ba034066
Require IPSEC_TUNNEL_MIGRATION feature flag to migrate transforms
Bug: 169169973
Test: atest IpSecServiceParameterizedTest (new tests added)
Change-Id: I3dd45b29163cd1e0cdbef08cb8aabdb629cf73bc

Yan Yan   commited 2022-12-21 23:12:48 +00:00
a48dcd9d1f
Support IPsec transform migration
This commit adds methods to support migrating tunnel mode
IpSecTransform to new source/destination addresses.

Bug: 169171001
Test: atest FrameworksNetTests (new tests added)
Change-Id: Ic177015fba5b62d3f73009633118109d3631086f

Yan Yan   commited 2022-12-21 23:12:35 +00:00
e114b38f07
Merge changes from topics "ADD_JVMOVERLOADS", "VPN_NETWORK_PREFERENCE"
* changes:
  Add HostsideVpnTests for testing setVpnDefaultForUids()
  Add CTS for ConnectivityManager#setVpnDefaultForUids()
  Create a new API to make a set of UIDs use only VPN by default

Lucas Lin   authored and   Gerrit Code Review   commited 2022-12-21 01:13:47 +00:00
e0e9b0c701
Merge "Ensure MTU is set for new interfaces."
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-12-20 14:51:33 +00:00
986fe9604b
Ensure MTU is set for new interfaces.
Setting the MTU for an interface should not be skipped when the
interface names are different. This occurs when a VPN network creates
a new interface with identical MTU.

Bug: 246398088
Test: atest ConnectivityServiceTest
Test: Manual test: Connect to VPN network and switch networks
Test: Confirm MTU of interface is set correctly with `adb shell ip addr`
Change-Id: I811a01feca2fb2130c57c6c924145314180434c5

Hansen Kurli   commited 2022-12-20 09:28:36 +00:00
0425203152
Create a new API to make a set of UIDs use only VPN by default
Create a new API - setVpnNetworkPreference() for the caller to
set VPN as the preference network.

VPN will be disconnected when its underlying network is gone.
To prevent packets going through an underlying network when the
underlying network is back but VPN is not connected yet, set VPN
as the only preferred network for specific apps.

Bug: 231749077
Test: 1. atest FrameworksNetTests
      2. Create a test app to register default network and check if
         the VPN is the only default network for the test app.
Change-Id: Iabcd38e2fec2aefedbf78d20e338f222d83a9e7f

lucaslin   commited 2022-12-19 05:35:04 +00:00
3ba7cc25c0
Merge changes If187d023,I41c557d6
* changes:
  Add MdnsAnnouncer
  Also use other compressed names in DNS compression

Treehugger Robot   authored and   Gerrit Code Review   commited 2022-12-15 04:31:37 +00:00
c12fede943
Rename getBypassable to isBypassable
Bug: 262336021
Bug: 256775913
Test: atest FrameworksNetTests
Change-Id: I5ac8f4f9a2a64189fc66d3c14af6da201a35e3e2

chiachangwang   authored and   Chiachang Wang   commited 2022-12-15 04:22:43 +00:00
2ed983512c
Add MdnsAnnouncer
MdnsAnnouncer is a implementations of MdnsPacketRepeater, which sends a
packet at various intervals.

It will be used to send initial advertisements when a service is
registered or there is a network change.

Bug: 241738458
Test: atest
Change-Id: If187d023dd48d9b575431759cc6b67460bc0d33b

Remi NGUYEN VAN   commited 2022-12-15 10:56:15 +09:00
a066e55bc5
Also use other compressed names in DNS compression
The previous implementation of writeLabels would not include a
compressed name in the label dictionary, so if a packet had
"something.local", "a.service.local" and "b.service.local",
"service.local" would not be compressed because "a.service.local"
already used compression (for .local).

Fix this and add a test.

Bug: 254166302
Test: atest
Change-Id: I41c557d6debd11acb4c0813735ef7af7323f45d7

Remi NGUYEN VAN   commited 2022-12-15 10:49:57 +09:00
e274170ac6
Use compression for mDNS NSEC record data
Although RFC3845 2.1.1 specifies that NSEC records should not use
compression for the Next DomainName field, RFC6762 18.14 specifies that
compression should also be used for NSEC RDATA. The legacy mDNS
implementation does use compression for that field.

Bug: 241738458
Test: atest
Change-Id: I9cd2b8618b01bb569a7f1d13dc3bfd09a0433300

Remi NGUYEN VAN   commited 2022-12-14 11:36:56 +09:00
f1fdca69a5
Add MdnsProber
MdnsProber is an implementation of MdnsPacketRepeater that will be used
to send probes for service names before advertising them, to know if
they are already in use.

Bug: 241738458
Test: atest
Change-Id: I4e5f779b891e2c665ba7f752fb5fbd4255070725

Remi NGUYEN VAN   commited 2022-12-14 11:36:55 +09:00
3568fddb36
Merge "Add unit tests checking MTU of interfaces are set."
Hansen Kurli   authored and   Gerrit Code Review   commited 2022-12-13 07:01:19 +00:00
edbf34a182