Android: Default to IPv6 when both AAAA and A record is returned by resolver

Created on 26 Oct 2018  Â·  14Comments  Â·  Source: nextcloud/android

Is your feature request related to a problem? Please describe.
Normal home internet connection will only be given 1 IPv4 address and use NAT. If there is another service using TCP/443, you will not get another TCP/443 for other service. Since there are no NAT for IPv6, you can open TCP/443 to the Internet on multiple machine without needing to use other port number for port forwarding.

Describe the solution you'd like
Use IPv6 by default when DNS resolver return both IPv6 and IPv4 addresses. Fallback to IPv4 if IPv6 connection does not works.

Additional context
Follow the Internet Standard!
Nextcloud desktop sync client seems to use IPv6 by default, why not do the same for android app?

enhancement pr exists

Most helpful comment

Hi @tobiasKaminsky,
should the development version on the main gihub page (latest.apk) already have the updated library version? I just downloaded and tested but could not verify the bugfix.

I was too impatient...
In todays dev version its working correctly. Thanks for making contribution painless!

All 14 comments

I am not sure if this is a problem related to our app or how Android itself is handling it, as we do not do anything with DNS.
Plain IPv6 connections are working.

Yup plain IPv6 is working (removing A record)
Browser (Firefox in my case) defaults to IPv6 when I have both A and AAAA record, but yeah I don't know how android and the nextcloud app interacts. Theoretically, it should be possible to make IPv6 the default since it is working for Firefox on Android. (Don't know if it is complicated to implement or not)

Additional info:
Version: Nextcloud 3.3.0 (Fdroid)
OS: Android 8.0.0
Phone: MHA-L29 (Huawei Mate 9)

Hi,
This didn't get an update so far, did it? There is another user in the Forum who only has an Dual-Stack-Lite Internet connection at home, meaning that home servers are only reachable via IPv6 address and not the shared IPv4 address (NAT):
https://help.nextcloud.com/t/nextcloud-app-android-ipv6-ds-lite/61477

Edit: Just found another forum post, which might be the same issue
https://help.nextcloud.com/t/ipv6-und-android-app/55484

Is there a way to prioritize IPv6 over IPv4? Seems like OwnCloud app and Firefox are doing that, because both work on that user's server.

I would like to second this. I am experiencing hairpinning issues that prevent me from accessing my server from the LAN if using IPv4. This seems to be quite a common issue (esp. with the orange ISP).

Other apps work fine, so I didn't bother setting up a custom DNS and DHCP server on my LAN to fix the issue with custom routes, but it started to bother me more lately (OCreader works, nextcloud news doesn't).

It is possible to reproduce this issue by setting a valid AAAA record and an invalid A one. The app will hang on "testing connection" during the login flow.

Not sure whether those links are relevant, but they could help:

I just experienced the same problem.
I have a domain with a AAAA record and all browsers use that. But the nextcloud app tries to use the A record.

I just did some tests with the HTTPClient and it does indeed work correctly if the system property is set:
System.setProperty("java.net.preferIPv6Stack" , "true");

Would you be open to this change?

Would you be open to this change?

Yes, I think this is ok.
Can you open a PR for this? :blue_heart:

Hi @tobiasKaminsky,
I created https://github.com/nextcloud/android/pull/6902

After testing the changes I found that it actually didnt fix the problem as expected. I created this pr: https://github.com/nextcloud/android-library/pull/503 which fixes the issue.

Library fix has been mergen and will ship with the next feature release (3.14.0)

Hi @tobiasKaminsky,
should the development version on the main gihub page (latest.apk) already have the updated library version? I just downloaded and tested but could not verify the bugfix.

Hi @tobiasKaminsky,
should the development version on the main gihub page (latest.apk) already have the updated library version? I just downloaded and tested but could not verify the bugfix.

I was too impatient...
In todays dev version its working correctly. Thanks for making contribution painless!

Thanks a lot for the fix!
Just a couple questions:

  • Will it fall back to IPv4 if connection can't be established over IPv6? (lack of connectivity, firewalling issues, invalid AAAA record and whatnot)?
  • Will other nextcloud apps require a similar patch, or do they make use of the library?

Thanks a lot for the fix!
Just a couple questions:

  • Will it fall back to IPv4 if connection can't be established over IPv6? (lack of connectivity, firewalling issues, invalid AAAA record and whatnot)?
  • Will other nextcloud apps require a similar patch, or do they make use of the library?

The fix was basically just removing code that explicitly preferes IPv4 over V6. So without V6 it will just fall back IPv4.

Not sure about the other apps.

* Will other nextcloud apps require a similar patch, or do they make use of the library?

If they use SSO, then they use this app for network and thus have the fix.
If they use the library, then they are also safe.
If they implemented in their own way, then they need to do similar…

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JSoko picture JSoko  Â·  3Comments

JSoko picture JSoko  Â·  3Comments

tobiasKaminsky picture tobiasKaminsky  Â·  3Comments

daywalk3r666 picture daywalk3r666  Â·  3Comments

markbryanduncan picture markbryanduncan  Â·  3Comments