Local discovery problem on Android 11

Hello all,

I am using the syncthing-fork for android and local discovery is not working (see also here: 735#) I have these logs when I activated beacon logs:

2020-12-29 11:44:31 Enabled debug data for "beacon"
2020-12-29 11:44:33 route ip+net: netlinkrib: permission denied
2020-12-29 11:44:33 Stopped broadcastBeacon writer: route ip+net: netlinkrib: permission denied
2020-12-29 11:44:33 broadcastBeacon: Failed service 'Service@0x40000d66c0 created by broadcastBeacon@0x4000138230/writer' (1.999843 failures of 2.000000), restarting: true, error: "{Service@0x40000d66c0 created by broadcastBeacon@0x4000138230/writer Service@0x40000d66c0 created by broadcastBeacon@0x4000138230/writer} returned unexpectedly", stacktrace: [unknown stack trace]
2020-12-29 11:44:33 Starting broadcastBeacon writer
2020-12-29 11:45:03 route ip+net: netlinkrib: permission denied
2020-12-29 11:45:03 Stopped broadcastBeacon writer: route ip+net: netlinkrib: permission denied
2020-12-29 11:45:03 broadcastBeacon: Failed service 'Service@0x40000d66c0 created by broadcastBeacon@0x4000138230/writer' (1.999810 failures of 2.000000), restarting: true, error: "{Service@0x40000d66c0 created by broadcastBeacon@0x4000138230/writer Service@0x40000d66c0 created by broadcastBeacon@0x4000138230/writer} returned unexpectedly", stacktrace: [unknown stack trace]
2020-12-29 11:45:03 Starting broadcastBeacon writer
2020-12-29 11:45:31 Exiting backoff state.
2020-12-29 11:45:31 Starting multicastBeacon writer
2020-12-29 11:45:31 Starting multicastBeacon reader
2020-12-29 11:45:31 route ip+net: netlinkrib: permission denied
2020-12-29 11:45:31 Stopped multicastBeacon writer: route ip+net: netlinkrib: permission denied
2020-12-29 11:45:31 multicastBeacon: Failed service 'Service@0x40000d6d80 created by multicastBeacon@0x40001382d0/writer' (1.000000 failures of 2.000000), restarting: true, error: "{Service@0x40000d6d80 created by

When you need more information, please let me know.

Hi, does any “Android freak” know if there have been changes to broadcast restrictions in Android 11? I’m still on 10 using a Xiaomi phone and local discovery works as expected. I can’t test this with 11 on the emulator as it does NAT the virtual phone “to” my physical computers running Syncthing. Could this also be a bug in Synching or does the error point to the OS as cause?

I know of generic restrictions in Android, but they were never a dealbreaker for Syncthing Android in the past, e.g. https://developer.android.com/reference/android/net/wifi/WifiManager.MulticastLock . Btw we do not aquire special multicast permissions in the app despite other big players like for example BubbleUPNP doing so to be able to use broadcasts.

It seems to be working for me on Android 11.

2020-12-29 20:54:42 sent 515 bytes to 192.168.0.255:21027 2020-12-29 20:54:42 write udp [::]:43262->[ff12::8384]:21027: sendmsg: network is unreachable on write to [ff12::8384]:21027 bond0 2020-12-29 20:54:42 sent 515 bytes to [ff12::8384]:21027 on wlan0 2020-12-29 20:54:42 write udp [::]:43262->[ff12::8384]:21027: sendmsg: network is unreachable on write to [ff12::8384]:21027 wlan1 2020-12-29 20:54:42 write udp [::]:43262->[ff12::8384]:21027: sendmsg: network is unreachable on write to [ff12::8384]:21027 p2p0 2020-12-29 20:54:42 recv 515 bytes from [fe80::b479:c9ff:fe98:1b28%wlan0]:43262 2020-12-29 20:54:58 recv 452 bytes from 192.168.0.102:35263 2020-12-29 20:54:58 recv 452 bytes from [fe80::c069:fd7f:5856:50e9%wlan0]:44536

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Sorry for re-opening this topic!

I have suddenly this problem too after updating my OnePlus 7t Pro yesterday to Android 11. Does anyone know how to fix this? Local discovery was 2/2 before. Now it does not work anymore. I used to use only fixed IP-addresses for Syncthing in my network but i recently switch to only local discovery.

Thanks a lot!

112123358-7acaeb80-8bc1-11eb-8f53-5e866211107d

Could you post the logs?

You can find logs in Catfriends Fork github.

For a log from me i have to find out how to get the log. The Syncthing Fork app does not show a log for Syncthing itself, only the Android log. Do i need to enable debug logs? Or detailed logs in the Syncthing App settings?

You can open the webinterface in the app and retrieve the logs from there

The log doesnt show anything like an error. Maybe i need to enable some debug info?

There’s logs in the first post. I don’t see any indication that yours should be any different. In the fork’s issue there’s a link to a golang issue with other projects observing something similar when targeting sdk30 (x/mobile: Calling net.InterfaceAddrs() fails on Android SDK 30 · Issue #40569 · golang/go · GitHub). So basically one more thing that currently wont work when targeting that. It worked for @kluppy - maybe they are using syncthing-android, which still targets sdk 29?

1 Like

I think @imsodin has covered all there to say , (again) it’s unfortunately up to Google to lower the restrictions in upcoming API levels. Not sure the golang team can do anything if the OS blocks the app to use it’s broadcasting features on Api 30.

Google Play sent me a notice which may be relevant for all gplay devs. In english, summarized : The date has been set when Gplay forces us to go up to target sdk level 30.

Neue Anforderungen an Android App Bundle und Ziel-API-Level in 2021

23. März 2021 01:00

Ab August 2021 müssen neue Apps auf das Ziel-API-Level 30 (Android 11) ausgerichtet werden und als Veröffentlichungsformat muss das Android App Bundle verwendet werden. Ab November 2021 müssen alle App-Updates auf das Ziel-API-Level 30 (Android 11) ausgerichtet werden. Apps mit einer Downloadgröße von über 150 MB werden jetzt von Play Asset Delivery und Play Feature Delivery unterstützt.

So the gplay version is crippled after November? Thanks Google /s

1 Like

@bt90 At least that’s what is NOW the case with the forked version on API 30. I’ve put a lot of work in to make most known features of the wrapper still work on Android 11, but some (local discovery, file watching, storage root and Downloads directory selection) are out of luck because of Google’s restrictions on that API level. Plus, I have the problem that I solved problems in code to be compatible and technically working with Android 11, but some new code isn’t Google Play Policy compliant (location access for WiFi SSID run conditions, all files access storage manager permission) what leaves the CURRENT forked release crippled and encouraging users to read GitHub (by their own initiative, as Google disallows third party APK sources announced in the play store by terms of use) and then find that they can use the F-Droid or GitHub releases.

What would help me on this, and the official Syncthing App, too of course:

  • If Google would open the applications of app devs with their apps to gain the exceptional permission “storage manager / all files access”.
  • If Google would allow the background location permission for a sync app (I don’t know why they rejected it more times again for the fork and accepted it for the official app → maybe different reviewer from Google’s team had different opinion on this???)

Last hope:

  • Android 11 will be remembered as some “shitty platform” to run Syncthing(-Fork) on and then Android 12 will lower the restrictions again in API 31, so a ray of hope comes upon us.

I doubt that Google will change its course here. “Use the Android APIs or get wrecked” seems to be the tone over the last few Android releases.

I fear that the UI-only approach of the app won’t work anymore at a certain point in the future. That means it needs to use Android APIs directly via gomobile or via the wrapper(e.g REST calls).

Let’s just hope that i’m completely wrong.

1 Like

Because @imsodin and @tomasz86 had atleast 4-5 rounds of modifying the privacy policy for it to finally be accepted.

4 Likes

4 posts were split to a new topic: Slow connection android

Local discovery was partly fixed in v1.16.0.5. The problem was Android 11 blocking apps from receiving multicast packets from the network. The app now holds the permission to create WifiManager.MulticastLock which allows receiving multicast packets from the local network thus lets the affected Android 11 discover other devices running Syncthing’s local discovery again.

Please note that Android 11 devices cannot discover other Android 11 devices using Syncthing’s local discovery mechanism because sending out multicast packets is still blocked by the OS. I didn’t figure out a way yet to let our NDK executable perform the sending of multicast packets.

Beside Android Developer documentation, here’s also a good writeup about multicast on Android in general: UDP Multicast on Android - CodeIsland (not Android 11 specific)