Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer IPv6 if its available #2198

Open
nshopik opened this issue Jun 27, 2016 · 31 comments · May be fixed by #27178
Open

Prefer IPv6 if its available #2198

nshopik opened this issue Jun 27, 2016 · 31 comments · May be fixed by #27178

Comments

@nshopik
Copy link

nshopik commented Jun 27, 2016

Steps to reproduce

  1. Open Telegram on dual-stacked host
  2. Telegram tries connect via IPv4 and IPv6
  3. Then drops IPv6 connection and stick to IPv4 only

Expected behaviour

It should stick to IPv6 if its available and not crippled, similar to happy eyeballs RFC6555

Actual behaviour

Always prefers IPv4, only disabling IPv4 make it stick to IPv6.

Configuration

Xubuntu 16.04
4.4.0-24-generic #43-Ubuntu SMP Wed Jun 8 19:27:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

v 0.9.56 alpha

Logs

startup log
https://gist.github.com/nshopik/31528efa4cce7dbccdd7d99f5ef9e862

@XenHat
Copy link

XenHat commented Jul 3, 2016

I would like to add that Telegram will also stay on IPV4 mode regardless of the user preference when behind an ISP-provided 6to4 tunnel (Videotron Ltee in my case). I have only tested this on Windows x64 so far.

@nshopik
Copy link
Author

nshopik commented Jul 3, 2016

@XenHat This is per design on most OSes, 2002::/16 prefix usually have lower precedence
https://tools.ietf.org/html/rfc6724#section-2.1 so it only selected to route within same prefix.

@nshopik
Copy link
Author

nshopik commented Sep 21, 2016

@john-preston This also somewhat improve security, as CGNAT become more common, IPv4 address from which somebody logged into your account could be same as yours and you could completely ignore that by mistake.

Thus connecting via IPv6 preferably give you better track your sessions

@stek29
Copy link
Contributor

stek29 commented Oct 6, 2016

Happens on OS X too by the way.

@vitordelucca
Copy link

This still happens on Windows.

@yangm97
Copy link

yangm97 commented May 27, 2017

Still happens on macOS.

@john-preston
Copy link
Member

Yes, currently IPv4 is preferred to IPv6, because IPv4 shows itself better, is more stable from both our side and local provider side.

@nshopik
Copy link
Author

nshopik commented May 27, 2017

@john-preston Is there any practical reason why checkbox try connecting through IPv6 unchecked by default then?

Yes, currently IPv4 is preferred to IPv6, because IPv4 shows itself better, is more stable from both our side and local provider side.

I would disagree on that, since iOS version and macOS native version prefer IPv6 and work flaweless

@john-preston
Copy link
Member

@nshopik On Windows I had several reports that when trying to connect both with IPv4 and IPv6 the first one was not working at all till the app restart, so this was moved to settings, disabled by default and on Windows it even requires app restart to change. I could not debug this issue back then and it wasn't a big problem anyway.

@yangm97
Copy link

yangm97 commented May 27, 2017

Wouldn’t it be better to have a dropdown in which the user chooses between auto (default, telegram tries to “reliability test” both), force ipv4 and force ipv6? Multiple users from multiple ISPs have mixed results, guess that would close this case once and for all.

@nshopik
Copy link
Author

nshopik commented May 29, 2017

@john-preston That's why I've suggested RFC6555 style address family selection instead dumb preference, which may cause problem. All current browsers implement it and correctly fallback to IPv4 if IPv6 in broken state.

Current IPv6 support just doesn't make sense, tdesktop support it but not enabled by default and even if you enable it still not even try connect IPv6 if IPv4 available. And as I'm rightly pointed out it make sense from security perspective when CGN comes into play to prefer IPv6 if its available and working.

@vitordelucca
Copy link

The problem is that even if you enable to use ipv6, it doesn't (unless you disable ipv4 stack on windows, which doesn't make any sense)

@stek29
Copy link
Contributor

stek29 commented May 30, 2017

Btw, Telegram deals with IPv6 pretty weirdly -- if you log in using it you get a private IP address in "somebody logged in" message

@nshopik
Copy link
Author

nshopik commented May 30, 2017

@stek29 They had issue with backend previously which report weird private IP ranges including multicast ranges, now it report correctly in active session tab at least for me it was fixed for about month

@Aokromes
Copy link
Collaborator

Aokromes commented Oct 2, 2017

Maybe dropdown to auto (prefered ipv6) auto (prefered ipv4) ipv4 ipv6? :)

@Lefey
Copy link

Lefey commented Apr 21, 2018

Please! Add dropdown to auto (prefered ipv6) / auto (prefered ipv4) / ipv4-only / ipv6-only

@bjo81
Copy link

bjo81 commented Jul 18, 2019

I have several clients which have IPv6 (no 6to4), "use IPv6" is enabled, but the connection is made via IPv4.

@kudrevatykh
Copy link

Just tested latest client and it successfully connected via IPv6

@stale
Copy link

stale bot commented Oct 24, 2020

Hey there!

This issue will be automatically closed in 7 days if there would be no activity. We therefore assume that the user has lost interest or resolved the problem on their own.

Don't worry though; if this is an error, let us know with a comment and we'll be happy to reopen the issue.

Thanks!

@stale stale bot added the stale label Oct 24, 2020
@Kirya2k
Copy link

Kirya2k commented Oct 24, 2020

It's time to remove this crutch.
In networks where there is ipv6, it is already more stable than ipv4.

@stale stale bot removed the stale label Oct 24, 2020
@ilya-fedin
Copy link
Contributor

ilya-fedin commented Oct 31, 2020

It's time to remove this crutch.

I have a feel that tdesktop won't use IPv6 until someone brave PR a RFC6555 implementation, since it seems really complicated and devs might have no time (or just too lazy) to implement.

@stale
Copy link

stale bot commented Apr 30, 2021

Hey there!

This issue was inactive for a long time and will be automatically closed in 30 days if there isn't any further activity. We therefore assume that the user has lost interest or resolved the problem on their own.

Don't worry though; if this is an error, let us know with a comment and we'll be happy to reopen the issue.

Thanks!

@stale stale bot added the stale label Apr 30, 2021
@Mikaela
Copy link

Mikaela commented Apr 30, 2021

I think this issue still exists.

@stale stale bot removed the stale label Apr 30, 2021
@booth-f
Copy link

booth-f commented Jul 5, 2021

Looks like this is still affecting networks where native IPv6 has been implemented. I've done everything I can think of in terms of "Best Practice" for deploying with IPv6 (SLAAC/RDNSS/ full /64s to each subnet) and I can see devices pick it up and use it for other things but Telegram is still falling back to IPv4.

@miyurusankalpa
Copy link

In my country, the unlimited packages have telegram limited to 1mbps, but I found out that it is only limited on IPv4. On IPv6 I get full speed.

I have setuped firewall rules to block telegram IPv4 address to force IPv6 in the desktop app. It would be better to other users if IPv6 was preferred when there is native connectivity.

@michelolvera
Copy link

I don't understand why use IPv4 before IPv6, is this a bug or a premeditated decision by telegram team?
If so, please explain why this decision was taken.

@ilya-fedin
Copy link
Contributor

@michelolvera read the thread, it was explained

@michelolvera
Copy link

@ilya-fedin so this decision will not change? It has been 5 years and it seems to me that the adoption of IPv6 has increased considerably, or if someone sends a PR with this functionality, do you think it would be accepted?

@ilya-fedin
Copy link
Contributor

@michelolvera I guess if someone sends a PR that implements this in a way that won't add connection problems (the mentioned RFC6555 apparently) then @john-preston won't be against that, but better to ask himself, maybe it's still blocked by server admins or something else...

@Aokromes Aokromes added enhancement and removed bug labels Feb 5, 2022
@SopaDeMacaco-UmaDelicia

Any news about the issue? It was first reported in 2016 when IPv6 adoption rate was 16%, now we live in 2022 where adoption world-wide is 42%. It's kinda dumb to use IPv4 when I have an IPv6 connection.

@ilya-fedin
Copy link
Contributor

No one volunteers for implementing RFC6555 in tdesktop

FlyGoat added a commit to FlyGoat/tdesktop that referenced this issue Dec 1, 2023
It is almost 2024 and there is no reason to perfer IPv4 over
IPv6, especially in tdesktop user still need to toggle a switch
to enable IPv6.

For tdesktop's connect test, if user does not have a routable
IPv6 address, onDisconnect will be called promptly to fallback
to another connection. If user's IPv6 connection is somehow
filtering out connection to telegram's server, it will wait
until kWaitForBetterTimeout and then fallback to another
connection.

This implementation is actually in spirit of happy eyeballs
recommandation.

Fixes: telegramdesktop#2198
Signed-off-by: Jiaxun Yang <[email protected]>
@FlyGoat FlyGoat linked a pull request Dec 1, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.