jbagg / QtZeroConf

Qt wrapper class for ZeroConf libraries across various platforms.
Other
70 stars 51 forks source link

Android API Level 30 issues #46

Open mzanetti opened 3 years ago

mzanetti commented 3 years ago

With Android API level 30, registering the zoerconf browser fails with

W qtMainLoopThrea: type=1400 audit(0.0:8386): avc: denied { ioctl } for path="socket:[6380337]" dev="sockfs" ino=6380337 ioctlcmd=0x8927 scontext=u:r:untrusted_app:s0:c154,c256,c512,c768 tcontext=u:r:untrusted_app:s0:c154,c256,c512,c768 tclass=tcp_socket permissive=0 app=io.guh.nymeaapp

The failing call is in netlink.c, in avahi_netlink_new

    if (bind(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {

fails with "Permission denied".

Now that new apps can't be uploaded any more with an API level less than 30 (and existing apps only until end of November) this becomes a real problem. I'm still debugging how to get it to work again but so far couldn't find anything.

dwebb72 commented 5 days ago

Thanks for the help. I had a double call to startBrowser that was causing the error. One more question, I am getting IPv6 addresses often. Is there a way to keep that form happening?

dwebb72 commented 1 day ago

When I build for android-34 I get IPv6 addresses and some don't show up at all. When I build for android-31 all works as expected. I tried changing the protocol in startBrowser to IPv4Protocol, IPv6Protocol and AnyIPProtocol. All have the same result.

Any ideas on what is causing this? Is the app you made scanning properly on android-34?

jbagg commented 1 day ago

My project's AndroidManifest is set to

<uses-sdk
        android:minSdkVersion="23"
        android:targetSdkVersion="34" />

I've tried it on

They are all able to discover the service from the raspberry pi. The QZeroConf Android NDS implementation ignores the protocol in startBrower, that is why you are getting IPv6 sometimes. It look like the java call can take a protocol parameter. I can try adding it later this week.

jbagg commented 1 day ago

I was wrong. The Android NSD api does not support specifying IPv4 vs IPv6 address. I saw the protocol parameter and got excited, but it has a different meaning than the avahi protocol parameter. I've been testing with my lineage nexus 5 and all it will give it ipv4 address unless I publish an ipv6 only service. I'll try the android 13 device in the next couple of days. If you print out the address coming from the upgrade signal, do you get a different address?