|Summary:||Multicast not working on Android 7.0 devices|
|Product:||Android||Reporter:||Sid Dubey <v-sidube>|
|Component:||BCL Class Libraries||Assignee:||Marek Habersack <grendel>|
|Severity:||normal||CC:||brendan.zagaeski, chrisntr, dominic, mono-bugs+monodroid, rob.derosa, robertvs-msft, v-sidube|
|Tags:||XATriaged||Is this bug a regression?:||---|
|Last known good build:|
Sample App for Repro
Screenshot on Android 7.0 device
Screenshot on Android 5.0 device
Description Sid Dubey 2016-09-14 15:09:31 UTC
Created attachment 17463 [details] Sample App for Repro Multicast DNS discovery has worked flawlessly on all Android platforms up until 7.0 (API 24). On Android 7.0, every single network interface reports back false, whereas on previous versions, the WIFI connection reports back true. A sample application which can reproduce the issue is attached. This sample Xamarin.Android app enumerates all the interfaces using System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces(). And for each interface returned, it checks the SupportsMulticast property. This property returns false for every network interface when the app is run on Android 7 devices.
Comment 1 Sid Dubey 2016-09-14 15:17:24 UTC
Created attachment 17464 [details] Screenshot on Android 7.0 device
Comment 2 Sid Dubey 2016-09-14 15:38:36 UTC
Created attachment 17465 [details] Screenshot on Android 5.0 device As you can see here WLAN0 returns TRUE
Comment 6 Rob DeRosa 2016-09-29 19:49:53 UTC
From a customer: "We have found that Bonjour browsing unexpectedly stops working on Android 7.0. After the investigation we’ve discovered, that the issue was related to usage of Wi-Fi network interface in general and it was caused by the changes in system WifiManager API. To address the issue are now using the ConnectivityManager API. We were using the WiFiManager API to get the WiFi MAC address to pick the proper network for mDNS search. Starting in Android 6.0 the programmatic access to the WiFi MAC address was disable, thusly the WiFiManager doesn’t report the actual identifier. In Android 6.0 we had mechanism to use the first non-loopback interface if no interfaces were found with the current MAC. This would happen on Android 6.0. For Android 7.0 the first loopback network interface is a fake, so it now fails. Because of this we moved to the ConnectivityManager API for Android 5+ devices. We can detect the WiFI interface without knowing the MAC address. I don’t know how the lower level networking is handled by the Xamarin libraries, but from the behaviors exhibited I would assume it is similar. I’m passing this along in hopes that it will speed up the fix for the defect that we are waiting on for a fix."
Comment 7 Marek Habersack 2016-09-30 13:09:14 UTC
The original issue happens because Google disabled access to some files in the /sys/class/net/[INTERFACE] files (for instance "flags", "operstate") which are what we use to determine the status of the interface including its multicast capability. I'm working on a different way to obtain the information from the system.
Comment 8 Marek Habersack 2016-09-30 14:17:40 UTC
Relevant upstream bug https://code.google.com/p/android/issues/detail?id=205565
Comment 9 Marek Habersack 2016-10-13 19:59:57 UTC
PRs with a fix/workaround are up: https://github.com/xamarin/xamarin-android/pull/261 and https://github.com/xamarin/monodroid/pull/522 - once those are accepted another PR, this time for Mono, will be opened and complete the fix for this issue. Alas, we won't be able to obtain arbitrary interface MAC - even Java classes can't provide us with the information.