The Free Software Media System - Server Backend & API
fix: IPv6 prefixes not recognized as proxy https://github.com/jellyfin/jellyfin/issues/15710
dwandw9962fbbe2ed2
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.mdindex eb2221f2b3..c42962786d 100644--- a/CONTRIBUTORS.md+++ b/CONTRIBUTORS.md@@ -228,6 +228,7 @@- [MarcoCoreDuo](https://github.com/MarcoCoreDuo)- [LiHRaM](https://github.com/LiHRaM)- [MSalman5230](https://github.com/MSalman5230)+ - [dwandw](https://github.com/dwandw)# Emby Contributorsdiff --git a/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs b/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.csindex c71c193e2e..a498901481 100644--- a/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs+++ b/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs@@ -312,7 +312,7 @@ namespace Jellyfin.Server.Extensionsreturn;}- if (prefixLength == NetworkConstants.MinimumIPv4PrefixSize)+ if ((addr.AddressFamily == AddressFamily.InterNetwork && prefixLength == NetworkConstants.MinimumIPv4PrefixSize) || (addr.AddressFamily == AddressFamily.InterNetworkV6 && prefixLength == NetworkConstants.MinimumIPv6PrefixSize)){options.KnownProxies.Add(addr);}diff --git a/tests/Jellyfin.Server.Tests/ParseNetworkTests.cs b/tests/Jellyfin.Server.Tests/ParseNetworkTests.csindex 14f4c33b6b..e788f43b86 100644--- a/tests/Jellyfin.Server.Tests/ParseNetworkTests.cs+++ b/tests/Jellyfin.Server.Tests/ParseNetworkTests.cs@@ -23,8 +23,8 @@ namespace Jellyfin.Server.Teststrue,true,new string[] { "192.168.t", "127.0.0.1", "::1", "1234.1232.12.1234" },- new IPAddress[] { IPAddress.Loopback },- new IPNetwork[] { new IPNetwork(IPAddress.IPv6Loopback, 128) });+ new IPAddress[] { IPAddress.Loopback, IPAddress.IPv6Loopback },+ Array.Empty<IPNetwork>());data.Add(true,@@ -37,8 +37,8 @@ namespace Jellyfin.Server.Teststrue,true,new string[] { "::1" },- Array.Empty<IPAddress>(),- new IPNetwork[] { new IPNetwork(IPAddress.IPv6Loopback, 128) });+ new IPAddress[] { IPAddress.IPv6Loopback },+ Array.Empty<IPNetwork>());data.Add(false,@@ -58,15 +58,15 @@ namespace Jellyfin.Server.Testsfalse,true,new string[] { "localhost" },- Array.Empty<IPAddress>(),- new IPNetwork[] { new IPNetwork(IPAddress.IPv6Loopback, 128) });+ new IPAddress[] { IPAddress.IPv6Loopback },+ Array.Empty<IPNetwork>());data.Add(true,true,new string[] { "localhost" },- new IPAddress[] { IPAddress.Loopback },- new IPNetwork[] { new IPNetwork(IPAddress.IPv6Loopback, 128) });+ new IPAddress[] { IPAddress.Loopback, IPAddress.IPv6Loopback },+ Array.Empty<IPNetwork>());return data;}