From 34d8e531e02c995836546e702e8dc4b02f2206e7 Mon Sep 17 00:00:00 2001 From: Shadowghost Date: Wed, 20 Jul 2022 09:48:20 +0200 Subject: [PATCH] Properly handle subnets in KnownProxies --- .../Extensions/ApiServiceCollectionExtensions.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs b/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs index 7030b726cd..5f9f50e315 100644 --- a/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs +++ b/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs @@ -182,7 +182,7 @@ namespace Jellyfin.Server.Extensions } /// - /// Extension method for adding the jellyfin API to the service collection. + /// Extension method for adding the Jellyfin API to the service collection. /// /// The service collection. /// An IEnumerable containing all plugin assemblies with API controllers. @@ -335,7 +335,7 @@ namespace Jellyfin.Server.Extensions } /// - /// Sets up the proxy configuration based on the addresses in . + /// Sets up the proxy configuration based on the addresses/subnets in . /// /// The containing the config settings. /// The string array to parse. @@ -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)