Ensure Thread network is never mDNS capable
Thread doesn't use mDNS and we should prevent NsdService from sending any mDNS traffic to Thread. Bug: 414258735 Test: CI Flag: EXEMPT bugfix Change-Id: I62299769cd44d2984b81b273adea7ce459d3d773
This commit is contained in:
parent
809869a8ee
commit
b59c829ff1
2 changed files with 15 additions and 1 deletions
|
|
@ -17,6 +17,7 @@
|
|||
package com.android.server.connectivity.mdns;
|
||||
|
||||
import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR;
|
||||
import static android.net.NetworkCapabilities.TRANSPORT_THREAD;
|
||||
import static android.net.NetworkCapabilities.TRANSPORT_VPN;
|
||||
import static android.net.NetworkCapabilities.TRANSPORT_WIFI;
|
||||
|
||||
|
|
@ -561,8 +562,9 @@ public class MdnsSocketProvider {
|
|||
private boolean isMdnsCapableInterface(
|
||||
@NonNull NetworkInterfaceWrapper iface, @NonNull int[] transports) {
|
||||
try {
|
||||
// Never try mDNS on cellular, or on interfaces with incompatible flags
|
||||
// Never try mDNS on cellular, on Thread, or on interfaces with incompatible flags
|
||||
if (CollectionUtils.contains(transports, TRANSPORT_CELLULAR)
|
||||
|| CollectionUtils.contains(transports, TRANSPORT_THREAD)
|
||||
|| iface.isLoopback()
|
||||
|| iface.isVirtual()
|
||||
|| !iface.isUp()) {
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ package com.android.server.connectivity.mdns;
|
|||
|
||||
import static android.net.NetworkCapabilities.TRANSPORT_BLUETOOTH;
|
||||
import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR;
|
||||
import static android.net.NetworkCapabilities.TRANSPORT_THREAD;
|
||||
import static android.net.NetworkCapabilities.TRANSPORT_VPN;
|
||||
import static android.net.NetworkCapabilities.TRANSPORT_WIFI;
|
||||
|
||||
|
|
@ -596,6 +597,17 @@ public class MdnsSocketProviderTest {
|
|||
testCallback.expectedNoCallback();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoSocketCreatedForThread() {
|
||||
startMonitoringSockets();
|
||||
|
||||
final TestSocketCallback testCallback = new TestSocketCallback();
|
||||
runOnHandler(() -> mSocketProvider.requestSocket(TEST_NETWORK, testCallback));
|
||||
|
||||
postNetworkAvailable(TRANSPORT_THREAD);
|
||||
testCallback.expectedNoCallback();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoSocketCreatedForNonMulticastInterface() throws Exception {
|
||||
doReturn(false).when(mTestNetworkIfaceWrapper).supportsMulticast();
|
||||
|
|
|
|||
Loading…
Reference in a new issue