Skip to content

Auto-enable IPv6 by default, unless disabled#3720

Open
softins wants to merge 1 commit into
jamulussoftware:mainfrom
softins:ipv6-auto-enable
Open

Auto-enable IPv6 by default, unless disabled#3720
softins wants to merge 1 commit into
jamulussoftware:mainfrom
softins:ipv6-auto-enable

Conversation

@softins
Copy link
Copy Markdown
Member

@softins softins commented May 30, 2026

Short description of changes

Auto-detects if the host supports IPv6, and enables it by default if so, unless explicitly disabled.

Removes -6 and --enableipv6, replacing them with --noipv6 to disable. 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 passed-in reference.

The bool bEnableIPv6 is gone, and the actual availability of IPv6 is published by a method in CClient or CServer.

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 --noipv6 option 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

  • I've verified that this Pull Request follows the general code principles
  • I tested my code and it does what I want
  • My code follows the style guide
  • I waited some time after this Pull Request was opened and all GitHub checks completed without errors.
  • I've filled all the content above

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.
@softins softins added this to the Release 4.0.0 milestone May 30, 2026
@softins softins self-assigned this May 30, 2026
@softins softins added the feature request Feature request label May 30, 2026
@softins softins added this to Tracking May 30, 2026
@github-project-automation github-project-automation Bot moved this to Triage in Tracking May 30, 2026
@pljones
Copy link
Copy Markdown
Collaborator

pljones commented May 30, 2026

If a server operator uses --serverbindip 192.168.1.123, does this achieve the same effect?

Does --serverbindip support IPv6 addresses? Presumably there's no option of "fall back" if that works.

@softins
Copy link
Copy Markdown
Member Author

softins commented May 30, 2026

If a server operator uses --serverbindip 192.168.1.123, does this achieve the same effect?

Does --serverbindip support IPv6 addresses? Presumably there's no option of "fall back" if that works.

At the moment, and ever since we introduced basic IPv6 support five years ago (!), --serverbindip is ignored completely if the socket is AF_INET6 (dual-stack). It is only honoured if the socket is plain AF_INET. That means in existing versions that -6 was not supplied, and in the new version of this PR, that either --noipv6 is given, or the host does not have an IPv6 stack available.

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 select() or poll() to handle them, instead of the blocking read loop we currently use. That would be a separate project for 4.1.0 or later!

Do you know what proportion of server operators actually use --serverbindip? I suspect it is extremely small.

For now, we could just stipulate that --serverbindip is only valid with --noipv6.

@pljones pljones moved this from Triage to In Progress in Tracking May 30, 2026
@pljones pljones moved this from In Progress to Waiting on Team in Tracking May 30, 2026
Copy link
Copy Markdown
Member

@ann0see ann0see left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will need to test this more thoroughly.

Comment thread src/main.cpp
qInfo() << "- IPv6 enabled";
CommandLineOptions << "--enableipv6";
bDisableIPv6 = true;
qInfo() << "- IPv6 disabled";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like that this makes clear that disabling IPv6 is not recommended. Maybe add (this is not recommended)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/main.cpp
" (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"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
" --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"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/client.cpp
bMuteOutStream ( false ),
fMuteOutStreamGain ( 1.0f ),
Socket ( &Channel, iPortNumber, iQosNumber, "", bNEnableIPv6 ),
bIPv6Available ( false ),
Copy link
Copy Markdown
Member

@ann0see ann0see May 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

@softins softins May 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This boolean is internal only, not for user-facing presentation, and I feel this way round makes the logic cleaner. This is my reasoning:

  1. We can safely assume all systems are IPv4 capable, but not necessarily IPv6 capable. So that makes the starting point ipv6avail = false
  2. The first thing we do, unless the user has explicitly told us not to, it attempt to create a v6-capable socket.
  3. If we succeed in doing so, we can set the ipv6avail flag to true.
  4. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature request Feature request

Projects

Status: Waiting on Team

Development

Successfully merging this pull request may close these issues.

Enable ipv6 client side support by default

3 participants