Auto-enable IPv6 by default, unless disabled#3720
Conversation
Removes -6 and --enableipv6, replacing with --noipv6. If --noipv6 is not specified, it will try first to open an IPv6 socket, and if the host does not support it, will fall back to an IPv4 socket. CSocket informs CClient or CServer of IPv6 availability via a reference. The bool bEnableIPv6 is gone, and the actual availability of IPv6 is published by a method in CClient or CServer.
|
If a server operator uses Does |
At the moment, and ever since we introduced basic IPv6 support five years ago (!), I don't think binding a specific address to a dual-stack socket makes any sense, and probably doesn't work. If we wanted to provide that ability we would need to open two separate sockets, one for 4 and another for 6, so they could each be bound to a separate specific address. This would then involve using Do you know what proportion of server operators actually use For now, we could just stipulate that |
ann0see
left a comment
There was a problem hiding this comment.
Will need to test this more thoroughly.
| qInfo() << "- IPv6 enabled"; | ||
| CommandLineOptions << "--enableipv6"; | ||
| bDisableIPv6 = true; | ||
| qInfo() << "- IPv6 disabled"; |
There was a problem hiding this comment.
I'd like that this makes clear that disabling IPv6 is not recommended. Maybe add (this is not recommended)
There was a problem hiding this comment.
Probably better in the documentation. It could get a bit wearing telling the user off every time when it's a conscious decision that has been made.
| " (see the Jamulus website to enable QoS on Windows)\n" | ||
| " -t, --notranslation disable translation (use English language)\n" | ||
| " -6, --enableipv6 enable IPv6 addressing (IPv4 is always enabled)\n" | ||
| " --noipv6 disable IPv6 addressing (IPv4 is always enabled)\n" |
There was a problem hiding this comment.
| " --noipv6 disable IPv6 addressing (IPv4 is always enabled)\n" | |
| " --noipv6 disable IPv6 addressing (only set this in case you have issues with IPv6. IPv4 is always enabled)\n" |
There was a problem hiding this comment.
Seems a bit verbose for a usage message, and probably better put in the documentation. Most people will probably not even be aware of IPv6, apart from the most technical.
| bMuteOutStream ( false ), | ||
| fMuteOutStreamGain ( 1.0f ), | ||
| Socket ( &Channel, iPortNumber, iQosNumber, "", bNEnableIPv6 ), | ||
| bIPv6Available ( false ), |
There was a problem hiding this comment.
Personal preference would be to have this flipped assuming IPv6 availability is there by default and we only set it to false in case we see it isn't. That would be more in line with the default enabled idea.
There was a problem hiding this comment.
This boolean is internal only, not for user-facing presentation, and I feel this way round makes the logic cleaner. This is my reasoning:
- We can safely assume all systems are IPv4 capable, but not necessarily IPv6 capable. So that makes the starting point ipv6avail = false
- The first thing we do, unless the user has explicitly told us not to, it attempt to create a v6-capable socket.
- If we succeed in doing so, we can set the ipv6avail flag to true.
- At this point, if the flag is still false (whether by user command or failure), we know we need to create a v4 socket.
I think to invert that logic would probably result in some unnecessary else clauses, and make the flow less tidy. I can't see a good reason to do so.
Short description of changes
Auto-detects if the host supports IPv6, and enables it by default if so, unless explicitly disabled.
Removes
-6and--enableipv6, replacing them with--noipv6to disable. If--noipv6is not specified, it will try first to open an IPv6 socket, and if the host does not support it, will fall back to an IPv4 socket.CSocketinformsCClientorCServerof IPv6 availability via a passed-in reference.The bool
bEnableIPv6is gone, and the actual availability of IPv6 is published by a method inCClientorCServer.CHANGELOG: Client/Server: Enable IPv6 by default if supported by host. Provide option to disable manually.
Context: Fixes an issue?
Fixes #3300
Does this change need documentation? What needs to be documented and how?
The
--noipv6option should be documented, along with an explanation the IPv6 is always enabled on supporting hosts.Status of this Pull Request
Tested locally on Linux and ready for review.
What is missing until this pull request can be merged?
Just review and testing on multiple platforms.
Checklist