Commit Graph

51 Commits

Author SHA1 Message Date
Yuyang Huang
de802c8dc4 Avoid going over max service name length when renaming NSD services
As per  RFC 1034/1035, the max size of the label is 63 bytes. It should
also be guaranteed when the serviceName is renamed due to the conflict.

Bug: 265865456
Test: atest FrameworksNetTests
Change-Id: I077d8abdb91071db62b9618d9918e3a12682aaf4
2023-05-04 13:24:23 +09:00
Yuyang Huang
a6a6ff93b2 Refactors common scope id setup code into utility function
Bug: 279691947
Test: atest NetworkStackIntegrationTests NetworkStackRootTests
Test: atest CtsNetTestCases:android.net.cts.NsdManagerTest
Change-Id: I5627037c95b5b9cf4af46018bccffb4f16b402a8
2023-04-27 11:37:50 +09:00
Paul Hu
b2e67d3aca Revert^2 "Put client logs into SharedLog and dump more logs"
b8a3a634a7

Change-Id: I7fe4ef575208d0cddc343112b9478f5898fd714a
2023-04-18 14:52:29 +08:00
Paul Hu
b8a3a634a7 Revert "Put client logs into SharedLog and dump more logs"
Revert submission 2535219

Reason for revert: Build break

Reverted changes: /q/submissionid:2535219

Change-Id: I4bb88b77c77254bb2f806c9e88b91dd304ad24bf
2023-04-18 02:45:34 +00:00
Paul Hu
eaa99274bd Put client logs into SharedLog and dump more logs
- Put client logs into SharedLog and dump them to the bugreport
- Adjust log format in bugreport.
- Also dump DiscoveryManager, Advertiser and SocketProvider logs

Before:
  NsdService:
   total records=9
   rec[0]: time=04-12 14:54:31.742 processed=DefaultState org=EnabledState dest=<null> what=REGISTER_CLIENT
   rec[1]: time=04-12 14:54:31.744 processed=EnabledState org=EnabledState dest=<null> what=REGISTER_SERVICE
   rec[2]: time=04-12 14:54:32.649 processed=EnabledState org=EnabledState dest=<null> what=DISCOVER_SERVICES
  curState=EnabledState

After:
NsdService:
 total records=9
 rec[0]: time=04-17 15:05:26.408 processed=DefaultState org=EnabledState dest=<null> what=REGISTER_CLIENT
 rec[1]: time=04-17 15:05:26.409 processed=EnabledState org=EnabledState dest=<null> what=REGISTER_SERVICE
 rec[2]: time=04-17 15:05:27.409 processed=EnabledState org=EnabledState dest=<null> what=DISCOVER_SERVICES
 rec[3]: time=04-17 15:05:28.236 processed=EnabledState org=EnabledState dest=<null> what=MDNS_DISCOVERY_MANAGER_EVENT
 rec[4]: time=04-17 15:05:28.241 processed=EnabledState org=EnabledState dest=<null> what=RESOLVE_SERVICE
 rec[5]: time=04-17 15:05:28.248 processed=EnabledState org=EnabledState dest=<null> what=MDNS_DISCOVERY_MANAGER_EVENT
 rec[6]: time=04-17 15:05:28.255 processed=EnabledState org=EnabledState dest=<null> what=UNREGISTER_SERVICE
 rec[7]: time=04-17 15:05:28.428 processed=DefaultState org=EnabledState dest=<null> what=UNREGISTER_CLIENT
curState=EnabledState

  2023-04-17T15:05:28.428230 - [Client10082-1] Client unregistered. expungeAllRequests!
  2023-04-17T15:05:28.241837 - [Client10082-1] Register a ResolutionListener 4 for service type:_nmt274981618._tcp.local
  2023-04-17T15:05:27.409895 - [Client10082-1] Register a DiscoveryListener 3 for service type:_nmt274981618._tcp.local
  2023-04-17T15:05:26.408015 - [Client10082-1] New client. useJavaBackend=true

Advertiser:
  2023-04-17T15:05:28.252545 - Removing service with ID 2
  2023-04-17T15:05:27.213023 - [testtap0] Probing finished for service 2
  2023-04-17T15:05:26.409607 - Adding service name: ^Nsd.Test|Non-#AsCiI\Characters&\ufffe テスト 測試, type: _nmt274981618._tcp, hostAddresses: , port: 12345, network: null, txtRecord:  with ID 2

DiscoveryManager:
  2023-04-17T15:05:28.428369 - Unregistering listener for serviceType:_nmt274981618._tcp.local
  2023-04-17T15:05:28.247622 - Unregistering listener for serviceType:_nmt274981618._tcp.local
  2023-04-17T15:05:28.241062 - Registering listener for serviceType: _nmt274981618._tcp.local
  2023-04-17T15:05:28.228777 - [_nmt274981618._tcp.local-102] onServiceFound: ^Nsd.Test|Non-#AsCiI\Characters&\ufffe テスト 測試
  2023-04-17T15:05:28.227786 - [_nmt274981618._tcp.local-102] onServiceNameDiscovered: ^Nsd.Test|Non-#AsCiI\Characters&\ufffe テスト 測試
  2023-04-17T15:05:27.409104 - createServiceTypeClient for serviceType:_nmt274981618._tcp.local network:102
  2023-04-17T15:05:27.398075 - Registering listener for serviceType: _nmt274981618._tcp.local

SocketProvider:
  2023-04-17T15:05:34.377599 - Stop monitoring sockets.
  2023-04-17T15:05:28.292106 - Remove socket on net:102
  2023-04-17T15:05:26.441517 - Create socket on net:NetworkAsKey{ network=102 }, ifName:testtap0
  2023-04-17T15:05:26.409005 - Start monitoring sockets.

Bug: 275004614
Test: atest FrameworksNetTests android.net.cts.NsdManagerTest
Change-Id: I41743f47abe5ca75c2a33da674d24d3a7f997d93
2023-04-17 15:39:45 +08:00
Yuyang Huang
700778be70 Handle downstream tethering interface addresses in MdnsSocketProvider
MdnsSocketProvider currently does not fill addresses of downstream
tethering interfaces in its callbacks. The interface addresses should be
properly updated by listening to the Netlink messages.

Test: atest FrameworksNetTests CtsNetTestCases
Bug: 267980538
Change-Id: I753e547a1b092703fe59c6c9e922ee8aca245f67
2023-04-15 21:55:51 +09:00
Yuyang Huang
3bee9d4099 Avoid creating a Network with INetd.LOCAL_NET_ID
INetd.LOCAL_NET_ID cannot be referred to by system SDK. To make the
MdnsSocketProvider built with system SDK, the reference to
INetd.LOCAL_NET_ID must be removed.

This network is created in MdnsSocketProvider.java and propagated
through MdnsSocketProvider.java -> MdnsMultinetworkSocketClient.java ->
MdnsDiscoveryManager.java -> MdnsServiceTypeClient.java ->
NsdService.java. In NsdService.java, it was used in
handleMdnsDiscoveryManagerEvent() -> buildNsdServiceInfoFromMdnsEvent()
-> setServiceNetworkForCallback(). The setServiceNetworkForCallback() is
updated to handle the NETID_UNSET the same as LOCAL_NET_ID.

Test: atest CtsNetTestCases FrameworksNetTests
Bug: 272392042
Change-Id: I07c573948e9dc6249325f0733807bb7a7ffc281c
2023-04-05 13:06:13 +09:00
Yuyang Huang
aa0e9602bb NsdService should set the Inet6Address scope ids
Link local Inet6Address cannot be used without scope id being set
properly. NsdService should set the Inet6Address scopes everywhere
NsdServiceInfo.setHost or NsdServiceInfo.setHostAddresses is used.

Test: atest CtsNetTestCases:android.net.cts.NsdManagerTest
Bug: 273391977
Change-Id: I45da6aebeba4e2e398e0b58ce3b88470fb60863b
2023-03-30 14:03:31 +09:00
Paul Hu
2e0a88c0fa Add a CompatChange flag to enable platform backend
Apps targeting sdk < U are considered to use a legacy native
daemon as NsdManager backend, but other apps use a
platform-integration mDNS implementation as backend. So add a
CompatChange flag to enable platform backend for non-legacy
apps.

Bug: 270306772
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I7ba58f8a5186fb49ad5f8aeacc8b8234bef1eabe
2023-03-17 09:10:46 +08:00
Remi NGUYEN VAN
d741db3334 Merge changes I53ebf1bb,I8540af27
* changes:
  Enable new NsdManager backend on U+
  Update NsdManagerTest for newer backend usage
2023-03-09 07:11:08 +00:00
Paul Hu
ee0e6cd701 Merge "Migrate reigster service callback backend" 2023-03-08 10:27:57 +00:00
Remi NGUYEN VAN
beb03f141c Enable new NsdManager backend on U+
Instead of using the old mdnsresponder backend, U+ uses
MdnsDiscoveryManager and MdnsAdvertiser.

Bug: 272197605
Test: atest NsdManagerTest
Change-Id: I53ebf1bbba24972e4db87eb4097497329b05caa9
2023-03-08 19:03:27 +09:00
Paul Hu
2b86591d39 Fill in all resolved addresses into NsdServiceInfo
Now, the multiple addresses is supported in resolution service
with the new java backend. Thus, fill in all resolved addresses
into NsdServiceInfo.

Bug: 268586836
Test: atest FrameworksNetTests
Change-Id: I499a749255429df9fe9fbad678074ad383159240
2023-03-06 14:27:53 +08:00
Paul Hu
30bd70d168 Migrate reigster service callback backend
registerServiceInfoCallback currently only sends updates for
addresses added, but does not handle removes (expiration) and
TXT/SRV record updates. Thus, migrate its backend to
MdnsDiscoveryManager which can support the expiration update.

Bug: 266030646
Test: atest FrameworksNetTests CteNetTestCases
Change-Id: I72add213935dc1beacb6277007868ad30bd89c00
2023-03-06 13:49:19 +08:00
Paul Hu
e4407fb469 Merge changes I987ab866,I73fa9ca7
* changes:
  Drop dot at the end of service type
  Implement the stop resolution with MdnsDiscoveryManager
2023-03-03 12:56:38 +00:00
Remi NGUYEN VAN
151d0a5528 Add flags for allowlisting types for new NSD impl
The flags allow enabling MdnsDiscoveryManager or MdnsAdvertiser for
specific service types only. For example:

  mdns_type_allowlist_flags = "_type1._tcp:flag1,_type2._tcp:flag2"
  mdns_discovery_manager_allowlist_flag1_version = 1234
  mdns_advertiser_allowlist_flag2_version = 2345

will enable MdnsDiscoveryManager when discovering/resolving services of
type _type1._tcp, and MdnsAdvertiser when advertising services of type
_type2._tcp.

Test: atest NsdServiceTest
Bug: 270885892
Change-Id: I75c31a28472210bf8777409ea7aff1e3d8bf0a0d
2023-03-03 18:00:59 +09:00
Paul Hu
7445e3dc78 Drop dot at the end of service type
The service type that found from NsdManager#discoverServices()
with old backend(mDnsResponder) has an extra dot at the end. And
the previous API accepted both formats, so we need to keep
backwards compatibility with both formats. Thus, drop that extra
dot when constructing the service type for the new backend.

Bug: 266030646
Test: atest FrameoworksNetTests
Change-Id: I987ab866f6a3a7cff654f96978057fdd93b859d6
2023-03-03 16:18:32 +08:00
Remi NGUYEN VAN
de5adc4f1f Merge changes I488cc768,Icb9ed7ae,Ib18c3afb,Iba293b47,Ied55829c, ...
* changes:
  Return ERROR_NO_ANSWERS for replies with no answer
  Allow resolving previously undiscovered services
  Use resolveInstanceName in NsdService
  Add missing SRV/TXT/address records to responses
  Update record TTL in set/add methods
  Clear inetaddress fields when removing the record
2023-03-03 07:45:24 +00:00
Paul Hu
e4f5f258d6 Implement the stop resolution with MdnsDiscoveryManager
The resolveService() uses new mdns backend if the
MdnsDiscoveryManager feature is enabled. So the new API
stopServiceResolution() should have new mdns backend
implementation as well.

Test: atest FrameworksNetTests
Change-Id: I73fa9ca71c0afc5db99db9252f4c030d4f2b8066
2023-03-03 14:20:11 +08:00
Remi NGUYEN VAN
bb62b1de50 Use resolveInstanceName in NsdService
For resolve requests, specify the resolveInstanceName in
MdnsSearchOptions.

This will cause discovery to send followup queries when TXT/SRV/A/AAAA
records are missing; for example if only a PTR record is returned
following the discovery probes, or if no discovery probe is sent at all.

Test: atest NsdServiceTest
Bug: 267570781
Change-Id: Ib18c3afbd1533ada7a78dd8ccac993adb439d014
2023-03-03 11:58:21 +09:00
Ahmad Khalil
8d45846632 Merge "Revert "Implement the stop resolution with MdnsDiscoveryManager"" 2023-03-02 11:58:28 +00:00
Ahmad Khalil
4b8d45a4c1 Revert "Implement the stop resolution with MdnsDiscoveryManager"
This reverts commit 6d77c41f2a.

Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?branch=aosp-master&target=aosp_cf_x86_64_phone-userdebug&lkgb=9678930&lkbb=9678975&fkbb=9678975, bug b/271400306

Change-Id: I8bfd2b8117ea401df7441116b983f5fe19f63d5d
BUG: 271400306
2023-03-02 11:43:25 +00:00
Paul Hu
1246c7243b Merge "Implement the stop resolution with MdnsDiscoveryManager" 2023-03-02 10:31:30 +00:00
Paul Hu
6d77c41f2a Implement the stop resolution with MdnsDiscoveryManager
The resolveService() uses new mdns backend if the
MdnsDiscoveryManager feature is enabled. So the new API
stopServiceResolution() should have new mdns backend
implementation as well.

Test: atest FrameworksNetTests
Change-Id: I591e78180f530daa701e0970860f7471f5f5fb9a
2023-03-02 14:57:25 +08:00
Paul Hu
58f2060614 Stop monitoring sockets until all sockets are unrequested
Now MdnsSocketProvider is stopped when there is no client request
left in NsdService, but this does not trigger
SocketCallback.onInterfaceDestroyed callbacks. If the network of
the socket is then lost while MdnsSocketProvider is not
monitoring, no callback will be fired. Users of the socket
(MdnsDiscoveryManager and MdnsAdvertiser) may keep using it
without ever getting notified. So ignore the stop and wait until
all sockets are unrequested. Then the socket destroy should be
notified to all users.

Bug: 267978487
Test: atest FrameworksNetTests
Change-Id: I7a8bb0550262fe397b91f1236a8dbca1cf2c7518
2023-03-02 10:56:35 +08:00
Remi NGUYEN VAN
a8a777bbbd Allow Advertiser, DiscoveryManager runtime toggle
Allow toggling MdnsAdvertiser and MdnsDiscoveryManager at runtime, by
always creating them in NsdService constructor, but only using them when
the flag is on when starting discovery, resolve or registration.

When stopping, based on the type of the stored request, stop the
corresponding backend.

Bug: 265891278
Test: atest NsdServiceTest
Change-Id: I7cb2f9fe9e1ed3dc77616689a8e3ffa00f5bc269
2023-01-27 19:37:04 +09:00
Remi NGUYEN VAN
8f453b9c9c Combine SparseArrays in ClientInfo
Instead of using three mClientIds, mClientRequests, mListeners
SparseArrays, use one array containing different subclasses of
ClientRequest.

This avoids having three arrays with mostly the same keys, and makes it
easier to differentiate requests for mdnsresponder, MdnsAdvertiser and
MdnsDiscoveryMaager.

It will also allow supporting having some requests using mdnsresponder,
and some other requests using MdnsAdvertiser or MdnsDiscoveryManager.
This is necessary to allow enabling/disabling the MdnsAdvertiser and
MdnsDiscoveryManager features without reboot.

There is a slight change in logging when DBG=true for ClientInfo:
Before:
    Exceeded max outstanding requests mResolvedService null
    mIsLegacy false
    clientId 2 mDnsId 2 type 1

After:
    Exceeded max outstanding requests mResolvedService null
    mIsLegacy false
    clientId 2 mDnsId 2 type NsdService$LegacyClientRequest

Bug: 265891278
Test: atest NsdServiceTest
Change-Id: Ibfb9bb5a61960ca635126b4a492fa0441484aa95
2023-01-27 19:05:43 +09:00
Remi NGUYEN VAN
5fc52a4b2f Merge "Do not return found services on dummy0" 2023-01-24 04:10:58 +00:00
Remi NGUYEN VAN
643edb6715 Do not return found services on dummy0
When registering and advertising a service on the same device, it is
possible for NsdService to find the service on the dummy0 interface. It
is however unusable and not resolveable.

Skip callbacks on the dummy0 interface as they would confuse apps and
tests.

Bug: 266176036
Test: atest NsdServiceTest
Change-Id: I98cca0135e0f6936187d45707cbdad7a7f263ff1
2023-01-23 19:14:57 +09:00
Paul Hu
18aecccc9d New API to listen service update
Currently, the resolution is a one shot query, it only notifies
the first finding service information. There is no way to listen
the service update. Thus, add a new API that can register a
callback to listen to the service updates continuously.

Bug: 245369943
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I0e9d92b9028375feb3e344ab6c4acb515c5b2be9
2023-01-19 20:16:03 +09:00
Remi NGUYEN VAN
fd02056713 Merge "New API to stop service resolution" 2023-01-19 01:51:50 +00:00
Remi NGUYEN VAN
5b9074cf7e Optionally use MdnsAdvertiser for advertising
Based on a flag, use MdnsAdvertiser for advertising instead of the
legacy mdnsresponder implementation.

Bug: 241738458
Test: atest NsdServiceTest
Change-Id: I2d5069097c11f2959e3792cac326d179a3116479
2023-01-18 23:23:43 +09:00
Paul Hu
b58deb706c New API to stop service resolution
Resolve service may take long time due to network issue or
using wrong service information, but users are not able to stop
it. They can only wait for the callback of resolveService to end,
which sometimes takes a long time. Thus, add the new API that
users can stop the service resolution.

Bug: 245369943
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I6b6183c8c73f8db981b9afa51fbc73bf886d9ed3
2023-01-18 10:10:25 +00:00
Paul Hu
75069ed47e Implement service resolved callback
Service resolved should be notified when receive the
onServiceFound callbacks from MdnsServiceBrowserListener

Bug: 254166302
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I681720065084bf3449c5b1ab44cd4ed6a659dcdb
2023-01-17 23:25:08 +08:00
Paul Hu
319751a572 Implement service lost callback
Service lost should be notified when receive the
onServiceNameRemoved callbacks from
MdnsServiceBrowserListener.

Bug: 254166302
Test: atest FrameworksNetTests
Change-Id: I298816ac186efeda85cea4cd11f3beab6b341bc5
2023-01-17 21:26:26 +08:00
Paul Hu
019621e070 Implement service found callback
Service found should be notified when receives the
onServiceNameDiscovered callbacks from
MdnsServiceBrowserListener.

Bug: 254166302
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I3f41b4fe85cd85ad356fa764663187a88914412c
2023-01-17 20:07:22 +08:00
Paul Hu
23fa202478 Use MdnsDiscoveryManager for discovery
Register/Unregister the listener to/from MdnsDiscoveryManager
when discovery started/stopped.

Bug: 254166302
Test: atest FrameworksNetTests CtsNetTestsCases
Change-Id: Ibd782029826ac5856c608165928cd942e46dd9a4
2023-01-17 19:16:50 +08:00
Paul Hu
4bd98ef68e 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
2023-01-17 00:26:01 +08:00
Paul Hu
116b4c0b6b Add null check for clientInfo
If the binder death notification for a INsdManagerCallback was
received before any calls are received by NsdService, the
clientInfo would be cleared and cause NPE. Thus, add a null check
to prevent crash.

Bug: 241741274
Test: atest FrameworksNetTests
Change-Id: Iebe761cd579bf3ee46ead389620bed60a21e3154
2022-08-16 07:21:55 +00:00
paulhu
3ffffe71c7 Use common methods to check/enforece mutiple permissions
Use PermissionUtils methods to check/enforece mutiple permissions
to avoid inconsistent behavior and duplicated code.

Bug: 177187957
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I0850a2c8b15e0dfc6d21298c5599ad36bb2056dc
2022-07-04 10:42:06 +00:00
Paul Hu
d65740346e Merge "Remove the DisabledState from NsdService" 2022-06-01 09:25:11 +00:00
Paul Hu
29f4359856 Remove the DisabledState from NsdService
In order to increase the line coverage for the Connectivity
module, remove the DisabledState from NsdService which is
uselss for a while.

Bug: 234315786
Test: atest FrameworksNetTests CtsNetTestCases \
      ConnectivityCoverageTest
Change-Id: I29c7ef608d97037084b25daa70ad5829f474e20a
2022-06-01 05:57:59 +00:00
Remi NGUYEN VAN
1a8ee102d3 Fix service resolve on tethering downstreams
Tethering downstreams do not have NetworkAgents, and although they have
a netid of 99, Networks with netId 99 are not usable by apps for most
connectivity APIs.

Recent refactoring in NsdService adds the Network of a found service
into its NsdServiceInfo, and uses that network to resolve the service.
In that case the Network has netId 99 and resolving the service fails.

Avoid that problem by:
 - Keeping the Network field null when a service is found on a tethering
   downstream; this avoids giving apps a confusing and unusable Network
   with netId 99
 - Using the interface index found during discovery to resolve the
   service, if the app uses the NsdServiceInfo that was obtained from
   discovery to resolve. If not, all interfaces will be used to resolve,
   as per legacy APIs.

Bug: 233979892
Test: atest NsdServiceTest
      Also manual test with 2 devices connected via hotspot
Change-Id: Idd176153b67ccbd1d4f1b1fd66dafaa2f3a9e27a
2022-05-31 13:06:22 +09:00
Treehugger Robot
eca1e920e5 Merge "Deal with non-ASCII characters on resolution info" 2022-05-17 06:51:46 +00:00
paulhu
be186602f9 Deal with non-ASCII characters on resolution info
The service name can include non-ASCII characters. So
NsdService need to have specific handling for these non-ASCII
characters that make resolution working properly.

Note: The unescape() method is the same one that was used in S,
but was removed by mistake.

Bug: 230698801
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I42fc5618aa2d549ceae25f516ad17c78930ea41d
2022-05-17 02:29:08 +00:00
Paul Hu
360a8e9e1b Register service on the specified network
Currently, NsdManager registers services on all interfaces when
one network was specified in NsdServiceInfo. It's unexpected
behavior. The service should be only advertised on specified
network. Thus, correct the behavior on NsdService and add cts
test to verify it.

Bug: 220070737
Test: atest CtsNetTestCases:android.net.cts.NsdManagerTest
Change-Id: Ief3bfa110bfa340c53edec561eb5376f6bd305e6
2022-04-28 20:55:30 +08:00
paulhu
1b35e829c6 Remove InterruptedException from NsdService#create
- NsdService isn't using NativeDaemonConnector to connect to
  mdnsresponder after aosp/2049246, so NsdService#create
  won't throw InterruptedException.
- Also no need to catch InterruptedException in
  ConnectivityServiceInitializer.

Bug: 209894875
Test: atest FrameworksNetTests CtsNetTestCases
Merged-In: I1d0b973f9dac0f1d4f9d4d03faef66f05edde3fc
Change-Id: I1d0b973f9dac0f1d4f9d4d03faef66f05edde3fc
2022-04-11 07:58:06 +00:00
paulhu
2b9ed95ae5 Use MDns aidl on NsdService
- Use MDns aidl to communicate with mdns service and register
  event listener to receive callback.
- Remove all NDC relevant code on NsdService.
- Use MDns aidl on NsdServiceTest.

Bug: 209894875
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I65929dee3838fef753396e86c665abd66b6fec81
2022-04-04 15:18:27 +00:00
Remi NGUYEN VAN
23651306c3 Support discover/resolve on specific networks
This adds a Network member to NsdServiceInfo, allowing discovered
services to report which network they were discovered on, and clients to
specify which network to resolve the service on. If clients use the
discovered NsdServiceInfo to resolve a service, it will be resolved on
the network where it was discovered instead of an unspecified network.

Also add a network parameter to a new overload of
NsdManager#discoverServices, so that clients can discover on specific
networks.

Bug: 190249673
Test: atest NsdManagerTest

Change-Id: Idc4bf9fde0f4b0328204a8cd2eedc12fffbbbdba
2022-02-03 13:04:08 +09:00
hepengtao
f6f9aa2b9a NSD: Specify on what interface to getAddrInfo
When discover two different host with same host name
from different network interface, specify on what
 interface to getAddrInfo.

Bug: 203453164
Test: build & manual

Signed-off-by: hepengtao <hept.hept.hept@gmail.com>
Change-Id: Ifaccb7f3fac6b1dd789cc9ce7c8d964102754508
2022-02-02 17:50:50 +09:00