aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShadowghost <Ghost_of_Stone@web.de>2022-07-20 09:48:20 +0200
committerShadowghost <Ghost_of_Stone@web.de>2022-07-20 09:48:20 +0200
commit34d8e531e02c995836546e702e8dc4b02f2206e7 (patch)
treea0b547e66765f90b28a32fbe5e74a11c1debf764
parent64ffd5fd9526762e27d97e13c59cc6552c97e7bc (diff)
Properly handle subnets in KnownProxies
-rw-r--r--Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs11
1 files changed, 9 insertions, 2 deletions
diff --git a/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs b/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs
index 7030b726c..5f9f50e31 100644
--- a/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs
+++ b/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs
@@ -182,7 +182,7 @@ namespace Jellyfin.Server.Extensions
}
/// <summary>
- /// Extension method for adding the jellyfin API to the service collection.
+ /// Extension method for adding the Jellyfin API to the service collection.
/// </summary>
/// <param name="serviceCollection">The service collection.</param>
/// <param name="pluginAssemblies">An IEnumerable containing all plugin assemblies with API controllers.</param>
@@ -335,7 +335,7 @@ namespace Jellyfin.Server.Extensions
}
/// <summary>
- /// Sets up the proxy configuration based on the addresses in <paramref name="allowedProxies"/>.
+ /// Sets up the proxy configuration based on the addresses/subnets in <paramref name="allowedProxies"/>.
/// </summary>
/// <param name="config">The <see cref="NetworkConfiguration"/> containing the config settings.</param>
/// <param name="allowedProxies">The string array to parse.</param>
@@ -348,6 +348,13 @@ namespace Jellyfin.Server.Extensions
{
AddIpAddress(config, options, addr, addr.AddressFamily == AddressFamily.InterNetwork ? 32 : 128);
}
+ else if (NetworkExtensions.TryParseSubnets(new[] { allowedProxies[i] }, out var subnets))
+ {
+ for (var j = 0; j < subnets.Count; j++)
+ {
+ AddIpAddress(config, options, subnets[j].Prefix, subnets[j].PrefixLength);
+ }
+ }
else if (NetworkExtensions.TryParseHost(allowedProxies[i], out var host))
{
foreach (var address in host)