aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Jellyfin.Networking/Manager/NetworkManager.cs12
-rw-r--r--Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs8
-rw-r--r--MediaBrowser.Common/Net/INetworkManager.cs42
-rw-r--r--MediaBrowser.Common/Net/IPData.cs8
-rw-r--r--MediaBrowser.Model/Net/ISocketFactory.cs1
-rw-r--r--RSSDP/SsdpCommunicationsServer.cs6
6 files changed, 39 insertions, 38 deletions
diff --git a/Jellyfin.Networking/Manager/NetworkManager.cs b/Jellyfin.Networking/Manager/NetworkManager.cs
index 12edb0e55..0f8f1a36a 100644
--- a/Jellyfin.Networking/Manager/NetworkManager.cs
+++ b/Jellyfin.Networking/Manager/NetworkManager.cs
@@ -263,7 +263,7 @@ namespace Jellyfin.Networking.Manager
if (_interfaces.Count == 0)
{
- _logger.LogWarning("No interfaces information available. Using loopback.");
+ _logger.LogWarning("No interface information available. Using loopback interface(s).");
if (IsIpv4Enabled && !IsIpv6Enabled)
{
@@ -450,6 +450,14 @@ namespace Jellyfin.Networking.Manager
_publishedServerUrls[new IPData(IPAddress.Any, new IPNetwork(IPAddress.Any, 0))] = replacement;
_publishedServerUrls[new IPData(IPAddress.IPv6Any, new IPNetwork(IPAddress.IPv6Any, 0))] = replacement;
}
+ else if (string.Equals(parts[0], "internal", StringComparison.OrdinalIgnoreCase))
+ {
+ foreach (var lan in _lanSubnets)
+ {
+ var lanPrefix = lan.Prefix;
+ _publishedServerUrls[new IPData(lanPrefix, new IPNetwork(lanPrefix, lan.PrefixLength))] = replacement;
+ }
+ }
else if (IPAddress.TryParse(ipParts[0], out IPAddress? result))
{
var data = new IPData(result, null);
@@ -469,7 +477,7 @@ namespace Jellyfin.Networking.Manager
}
else
{
- _logger.LogError("Unable to parse bind ip address. {Parts}", parts[1]);
+ _logger.LogError("Unable to parse bind override: {Entry}", entry);
}
}
}
diff --git a/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs b/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs
index a393b80db..25516271c 100644
--- a/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs
+++ b/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs
@@ -350,14 +350,14 @@ namespace Jellyfin.Server.Extensions
}
else if (NetworkExtensions.TryParseSubnets(new[] { allowedProxies[i] }, out var subnets))
{
- for (var j = 0; j < subnets.Count; j++)
+ foreach (var subnet in subnets)
{
- AddIpAddress(config, options, subnets[j].Prefix, subnets[j].PrefixLength);
+ AddIpAddress(config, options, subnet.Prefix, subnet.PrefixLength);
}
}
- else if (NetworkExtensions.TryParseHost(allowedProxies[i], out var host))
+ else if (NetworkExtensions.TryParseHost(allowedProxies[i], out var addresses))
{
- foreach (var address in host)
+ foreach (var address in addresses)
{
AddIpAddress(config, options, address, address.AddressFamily == AddressFamily.InterNetwork ? 32 : 128);
}
diff --git a/MediaBrowser.Common/Net/INetworkManager.cs b/MediaBrowser.Common/Net/INetworkManager.cs
index 21ff98237..d462e954a 100644
--- a/MediaBrowser.Common/Net/INetworkManager.cs
+++ b/MediaBrowser.Common/Net/INetworkManager.cs
@@ -17,14 +17,14 @@ namespace MediaBrowser.Common.Net
event EventHandler NetworkChanged;
/// <summary>
- /// Gets a value indicating whether IPv6 is enabled.
+ /// Gets a value indicating whether IPv4 is enabled.
/// </summary>
- bool IsIpv6Enabled { get; }
+ bool IsIpv4Enabled { get; }
/// <summary>
- /// Gets a value indicating whether IPv4 is enabled.
+ /// Gets a value indicating whether IPv6 is enabled.
/// </summary>
- bool IsIpv4Enabled { get; }
+ bool IsIpv6Enabled { get; }
/// <summary>
/// Calculates the list of interfaces to use for Kestrel.
@@ -42,7 +42,7 @@ namespace MediaBrowser.Common.Net
IReadOnlyList<IPData> GetLoopbacks();
/// <summary>
- /// Retrieves the bind address to use in system url's. (Server Discovery, PlayTo, LiveTV, SystemInfo)
+ /// Retrieves the bind address to use in system URLs. (Server Discovery, PlayTo, LiveTV, SystemInfo)
/// If no bind addresses are specified, an internal interface address is selected.
/// The priority of selection is as follows:-
///
@@ -56,40 +56,40 @@ namespace MediaBrowser.Common.Net
///
/// If the source is from a public subnet address range and the user hasn't specified any bind addresses:-
/// The first public interface that isn't a loopback and contains the source subnet.
- /// The first public interface that isn't a loopback. Priority is given to interfaces with gateways.
- /// An internal interface if there are no public ip addresses.
+ /// The first public interface that isn't a loopback.
+ /// The first internal interface that isn't a loopback.
///
/// If the source is from a private subnet address range and the user hasn't specified any bind addresses:-
/// The first private interface that contains the source subnet.
- /// The first private interface that isn't a loopback. Priority is given to interfaces with gateways.
+ /// The first private interface that isn't a loopback.
///
/// If no interfaces meet any of these criteria, then a loopback address is returned.
///
- /// Interface that have been specifically excluded from binding are not used in any of the calculations.
+ /// Interfaces that have been specifically excluded from binding are not used in any of the calculations.
/// </summary>
/// <param name="source">Source of the request.</param>
/// <param name="port">Optional port returned, if it's part of an override.</param>
- /// <returns>IP Address to use, or loopback address if all else fails.</returns>
+ /// <returns>IP address to use, or loopback address if all else fails.</returns>
string GetBindInterface(HttpRequest source, out int? port);
/// <summary>
- /// Retrieves the bind address to use in system url's. (Server Discovery, PlayTo, LiveTV, SystemInfo)
+ /// Retrieves the bind address to use in system URLs. (Server Discovery, PlayTo, LiveTV, SystemInfo)
/// If no bind addresses are specified, an internal interface address is selected.
/// (See <see cref="GetBindInterface(IPAddress, out int?)"/>.
/// </summary>
/// <param name="source">IP address of the request.</param>
/// <param name="port">Optional port returned, if it's part of an override.</param>
- /// <returns>IP Address to use, or loopback address if all else fails.</returns>
+ /// <returns>IP address to use, or loopback address if all else fails.</returns>
string GetBindInterface(IPAddress source, out int? port);
/// <summary>
- /// Retrieves the bind address to use in system url's. (Server Discovery, PlayTo, LiveTV, SystemInfo)
+ /// Retrieves the bind address to use in system URLs. (Server Discovery, PlayTo, LiveTV, SystemInfo)
/// If no bind addresses are specified, an internal interface address is selected.
/// (See <see cref="GetBindInterface(IPAddress, out int?)"/>.
/// </summary>
/// <param name="source">Source of the request.</param>
/// <param name="port">Optional port returned, if it's part of an override.</param>
- /// <returns>IP Address to use, or loopback address if all else fails.</returns>
+ /// <returns>IP address to use, or loopback address if all else fails.</returns>
string GetBindInterface(string source, out int? port);
/// <summary>
@@ -100,7 +100,6 @@ namespace MediaBrowser.Common.Net
/// <summary>
/// Returns true if the address is part of the user defined LAN.
- /// The configuration option TrustIP6Interfaces overrides this functions behaviour.
/// </summary>
/// <param name="address">IP to check.</param>
/// <returns>True if endpoint is within the LAN range.</returns>
@@ -108,7 +107,6 @@ namespace MediaBrowser.Common.Net
/// <summary>
/// Returns true if the address is part of the user defined LAN.
- /// The configuration option TrustIP6Interfaces overrides this functions behaviour.
/// </summary>
/// <param name="address">IP to check.</param>
/// <returns>True if endpoint is within the LAN range.</returns>
@@ -119,21 +117,21 @@ namespace MediaBrowser.Common.Net
/// eg. "eth1", or "enp3s5".
/// </summary>
/// <param name="intf">Interface name.</param>
- /// <param name="result">Resultant object's ip addresses, if successful.</param>
+ /// <param name="result">Resulting object's IP addresses, if successful.</param>
/// <returns>Success of the operation.</returns>
bool TryParseInterface(string intf, out List<IPData>? result);
/// <summary>
- /// Returns all the internal bind interface addresses.
+ /// Returns all internal (LAN) bind interface addresses.
/// </summary>
- /// <returns>An internal list of interfaces addresses.</returns>
+ /// <returns>An list of internal (LAN) interfaces addresses.</returns>
IReadOnlyList<IPData> GetInternalBindAddresses();
/// <summary>
- /// Checks to see if <paramref name="remoteIp"/> has access.
+ /// Checks if <paramref name="remoteIp"/> has access to the server.
/// </summary>
- /// <param name="remoteIp">IP Address of client.</param>
- /// <returns><b>True</b> if has access, otherwise <b>false</b>.</returns>
+ /// <param name="remoteIp">IP address of the client.</param>
+ /// <returns><b>True</b> if it has access, otherwise <b>false</b>.</returns>
bool HasRemoteAccess(IPAddress remoteIp);
}
}
diff --git a/MediaBrowser.Common/Net/IPData.cs b/MediaBrowser.Common/Net/IPData.cs
index 6901d6ad8..384efe8f6 100644
--- a/MediaBrowser.Common/Net/IPData.cs
+++ b/MediaBrowser.Common/Net/IPData.cs
@@ -12,9 +12,9 @@ namespace MediaBrowser.Common.Net
/// <summary>
/// Initializes a new instance of the <see cref="IPData"/> class.
/// </summary>
- /// <param name="address">An <see cref="IPAddress"/>.</param>
+ /// <param name="address">The <see cref="IPAddress"/>.</param>
/// <param name="subnet">The <see cref="IPNetwork"/>.</param>
- /// <param name="name">The object's name.</param>
+ /// <param name="name">The interface name.</param>
public IPData(IPAddress address, IPNetwork? subnet, string name)
{
Address = address;
@@ -25,7 +25,7 @@ namespace MediaBrowser.Common.Net
/// <summary>
/// Initializes a new instance of the <see cref="IPData"/> class.
/// </summary>
- /// <param name="address">An <see cref="IPAddress"/>.</param>
+ /// <param name="address">The <see cref="IPAddress"/>.</param>
/// <param name="subnet">The <see cref="IPNetwork"/>.</param>
public IPData(IPAddress address, IPNetwork? subnet)
: this(address, subnet, string.Empty)
@@ -53,7 +53,7 @@ namespace MediaBrowser.Common.Net
public string Name { get; set; }
/// <summary>
- /// Gets the AddressFamily of this object.
+ /// Gets the AddressFamily of the object.
/// </summary>
public AddressFamily AddressFamily
{
diff --git a/MediaBrowser.Model/Net/ISocketFactory.cs b/MediaBrowser.Model/Net/ISocketFactory.cs
index e5cf7adbc..f3bc31796 100644
--- a/MediaBrowser.Model/Net/ISocketFactory.cs
+++ b/MediaBrowser.Model/Net/ISocketFactory.cs
@@ -1,6 +1,5 @@
#pragma warning disable CS1591
-using System.Collections.Generic;
using System.Net;
namespace MediaBrowser.Model.Net
diff --git a/RSSDP/SsdpCommunicationsServer.cs b/RSSDP/SsdpCommunicationsServer.cs
index e6c0a4403..92c9c83c0 100644
--- a/RSSDP/SsdpCommunicationsServer.cs
+++ b/RSSDP/SsdpCommunicationsServer.cs
@@ -142,11 +142,7 @@ namespace Rssdp.Infrastructure
if (_BroadcastListenSockets != null)
{
_logger.LogInformation("{0} disposing _BroadcastListenSocket", GetType().Name);
- foreach (var socket in _BroadcastListenSockets)
- {
- socket.Dispose();
- }
-
+ _BroadcastListenSockets.ForEach(s => s.Dispose());
_BroadcastListenSockets = null;
}
}