Backport pull request #12094 from jellyfin/release-10.9.z

Map IPv6 mapped IPv4 addresses back to IPv4 before running checks

Original-merge: f097aad01e

Merged-by: Bond-009 <bond.009@outlook.com>

Backported-by: Joshua M. Boniface <joshua@boniface.me>
This commit is contained in:
Shadowghost 2024-06-23 11:40:54 -04:00 committed by Joshua M. Boniface
parent 034c13c48f
commit 9c96ce5f6e

View File

@ -919,10 +919,14 @@ public class NetworkManager : INetworkManager, IDisposable
{
ArgumentNullException.ThrowIfNull(address);
// See conversation at https://github.com/jellyfin/jellyfin/pull/3515.
// Map IPv6 mapped IPv4 back to IPv4 (happens if Kestrel runs in dual-socket mode)
if (address.IsIPv4MappedToIPv6)
{
address = address.MapToIPv4();
}
if ((TrustAllIPv6Interfaces && address.AddressFamily == AddressFamily.InterNetworkV6)
|| address.Equals(IPAddress.Loopback)
|| address.Equals(IPAddress.IPv6Loopback))
|| IPAddress.IsLoopback(address))
{
return true;
}