kvirc / KVIrc

The KVIrc IRC Client
http://www.kvirc.net/
GNU General Public License v2.0
244 stars 74 forks source link

Automatically choose between IPv4 and IPv6 #1760

Open DarthGandalf opened 8 years ago

DarthGandalf commented 8 years ago

Without need to explicitly select IPv6

Heufneutje commented 8 years ago

:+1:

staticfox commented 8 years ago

:+1:

xrogaan commented 8 years ago

Detecting if a host possess an IPv6 doesn't mean that there is an ircd behind that ip. This could be a bit tricky.

Mikaela commented 8 years ago

Detecting if a host possess an IPv6 doesn't mean that there is an ircd behind that ip. This could be a bit tricky.

That is why there are Happy Eyeballs aka RFC 6555.

wodim commented 8 years ago

I vote for connecting to IPv4 addresses by default always unless the server has only AAAA records. Less problematic.

Mikaela commented 8 years ago

I vote for connecting to IPv4 addresses by default always unless the server has only AAAA records. Less problematic.

That is just wrong. How would you handle IPv6-only systems (which also do resolve A records) or networks killing connections due to having too many connections behind Carrier Grade NAT?

Dagger0 commented 8 years ago

I disagree: v6 should be preferred if it's available. Just do a getaddrinfo() call and try the addresses in the order they come back. The OS will take care of putting v6 or v4 first as appropriate.

If a server publishes an address (whether it's an AAAA record or one of multiple A records) then it's their responsibility to make sure it works. FWIW, I can't remember seeing any IRC servers with broken AAAA records in their primary DNS for a long time now.

wodim commented 8 years ago

That is just wrong. How would you handle IPv6-only systems (which also do resolve A records)

I have yet to see an IPv6-only system in the wild.

or networks killing connections due to having too many connections behind Carrier Grade NAT?

I have yet to see a CGN in the wild.

I disagree: v6 should be preferred if it's available. Just do a getaddrinfo() call and try the addresses in the order they come back. The OS will take care of putting v6 or v4 first as appropriate.

I don't want to rely on that.

If a server publishes an address (whether it's an AAAA record or one of multiple A records) then it's their responsibility to make sure it works. FWIW, I can't remember seeing any IRC servers with broken AAAA records in their primary DNS for a long time now.

Chances are that the A record will always work while the AAAA record might not. Also, your ISP might have a broken implementation, broken routes, or whatever.

ctrlaltca commented 8 years ago

Proposal: The "ipv6" per-server option becomes a "use ipv6 only" option (so it just works like it does now). A new general "always try ipv6 first when connection to a server" option (disabled by default) gets added, implementing RFC6555 (if it's possible with Qt). When ipv6 will be the default stack for most users (and my grandchildrens will live on mars, probably), we'll switch the option default on.

Dessa commented 8 years ago

+1 to this proposal

wodim commented 8 years ago

My proposal is to, instead of implementing RFC 6555, have a combobox in the global kvirc settings dialog that says "prefer to connect over ipv4/ipv6" that makes A or AAAA records take precedence when connecting. (And ipv4 would be the default, of course.)

If a server has only AAAA records, we'd connect through ipv6 even if that combobox says "I'd rather use ipv4".

ctrlaltca commented 8 years ago

Your proposal is even better than mine. What about the per-server ipv6 checkbox? we need a way to force a different behavior for a specific server (eg one with a broken dns).

Dagger0 commented 8 years ago

None of these "always prefer v4" or "always prefer v6" suggestions can work very well though. The right address to prefer for a given connection depends not only on the IPs the destination has, but also on the IPs currently assigned to the source machine (which can change when you move between networks), the length of the longest shared prefix and also on system administrator preference. See RFC 6724 if you want to know all the gory details.

getaddrinfo() takes all of this into account for you already, so I suggest to use the ordering it gives you by default, with a per-server option to force v4 or v6 in the cases where it's necessary.

gparent commented 8 years ago

I have to go with Dagger0 here, most problems I see with software and IPv6 is when it tries to be smarter than the RFCs and doing completely the wrong thing as a result.

DarthGandalf commented 8 years ago

My proposal is to, instead of implementing RFC 6555

What's wrong with RFC 6555, if it's implemented?

DarthGandalf commented 8 years ago

implementing RFC6555 (if it's possible with Qt).

Qt can't prevent application from opening two sockets instead of one.

wodim commented 8 years ago

What's wrong with RFC 6555, if it's implemented?

Nothing, but it seems complicated to implement. My idea is clean and easy to have done.

DarthGandalf commented 8 years ago

My idea is clean and easy

and wrong, as it doesn't allow user to (automatically) use IPv6 on a non-IPv6-only computer.

wodim commented 8 years ago

and wrong, as it doesn't allow user to use IPv6 on a non-IPv6-only computer.

No, since servers have a "ipv6" checkbox (or the -i switch of /server) to use ipv6 only.

DarthGandalf commented 8 years ago

This is about automatic selection, without requiring user to press special buttons to enable it.

wodim commented 8 years ago

If it's automatic, the user does not care whether he's using ipv4 or ipv6.

Mikaela commented 8 years ago

But the user does care when their CGN hits the connection limit.

You might not have encountered CGN, but it doesn't mean that it doesn't exist. All mobile ISPs in Finland have it and as ISPs don't want to spend money they sell wireless connections insgead of bulding cables to not so habitated areas. I am personally also behind CGN.

wodim commented 8 years ago

You gotta be kidding me if you are telling me hitting the CGN connection limit is a legitimate concern. Is hitting the limit of opened ports in your computer a legitimate concern too?

Mikaela commented 8 years ago

I am not aware of any IRCd or network that allows unlimited amount of connections from single legacy IP which includes IP of CGN. This was especially issue with IRCnet.

Mikaela commented 8 years ago

Ibsee that I am a little unclear, so I am trying to be more accurate.

Three people use ISP X which has DualStack Lite. They all connect to IRC network at differenr rimes and when they happen to be connected to it at the same time using IPv4, the IRCd decides that 3 addresses from the same IPv4 address hits the connection limit and kills them all also setting temporary ban on the CGN, so it doesn't reconnect immediately.

I am aware of only freenode having nf higher limits and I think InspIRCd default is 5 and less than 10 is popular limit.

Is KVIrc going to believe that every ISP has smaller amount of IRC users than 5? It just won't work and these issues are already here today.

Is hitting the limit of opened ports in your computer a legitimate concern too?

I have no idea where you took this or how it's related to the issue. There are a lot more ports than IRCds accept from single IP address.

wodim commented 8 years ago

I misunderstood what you meant by connection limit. Now I see. Anyway:

  1. Most mobile ISPs put their customers behind a NAT not because of the hypothetical scarcity of IP addresses, but to increase the security of those inside the CGN, leaving no ports open to the WAN.
  2. IRC is dead so hitting the connection limit per IP on a server just because you are inside a CGN would be a very interesting coincidence. And no ISP will put hundreds of clients inside a CGN anyway. What kind of an ISP are you referring to that has all of its clients inside a NAT with a unique IP address? That's delusional.
  3. If the user hits the CGN connection limit on a server he can ask for an I-line or whatever it's called nowadays.
  4. The user can always choose to connect using IPv6.
DarthGandalf commented 8 years ago

Most mobile ISPs put their customers behind a NAT not because of the hypothetical scarcity of IP addresses, but to increase the security of those inside the CGN, leaving no ports open to the WAN.

Most ISPs (even non-mobile) in Russia put their customers behind a NAT exactly because of the scarcity of IP addresses. Depending on the ISP, real IP address can be given to the customer for an additional price.

The user can always choose to connect using IPv6.

You're repeating yourself. User can choose, but it's no way automatic.

gparent commented 8 years ago

We shouldn't have to choose to use IPv6, we should have to choose to use legacy IP. If IPv6 works fine on a terminal, then obviously it should be used by default.

senposage commented 8 years ago

at minium if i type ipv6.hostname.net or irc6.hostname.net it should be smart enough to switch to ipv6 in those cases and DHCP6 with prefix delegation is pretty much standard now and windows 10 will perfer ipv6 over ipv4 by default

Mikaela commented 8 years ago

What network actually uses ipv6 subdomain nowadays?

ipv6.irc.freenode.net is an alias for ipv6.chat.freenode.net.
ipv6.chat.freenode.net is an alias for chat.freenode.net.

The correct way to choose between IPv6 and IPv4 is defined by RFC 6555, Happy Eyeballs and you will encounter issues with other methods.