Check if IPv6 is disabled to avoid failure when creating forwarder socket (fixes #2915) #2916
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As explained in #2915, if IPv6 is disabled (e.g., via kernel), creating IPv6 sockets will fail. This is a problem with RTP forwarders in the AudioBridge and VideoRoom, since we always create an IPv6 socket to send to both IPv4 and IPv6 (a single socket is created per publisher, which means the same socket can send to different families). As a result, forwarders will always fail in a system with those constraints.
This patch tries to address the problem by making a check when the plugin is started: we try and create a socket like the one we'd use for forwarders, and if that fails, we consider IPv6 unavailable. As a result, in that case we only create IPv4 sockets, and return an error if there's an attempt to forward to an IPv6 address.
I tested this briefly and it seems to work as expected, but of course you may want to make sure this doesn't break anything for you, especially if you use forwarders a lot. Notice that this PR is on master, but when this is merged I'll make sure to backport the changes to
0.x
as well.