aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShadowghost <Ghost_of_Stone@web.de>2022-10-01 20:00:35 +0200
committerShadowghost <Ghost_of_Stone@web.de>2022-10-01 21:42:31 +0200
commitbd9a940fed129d99fe9ffedafec324e795549c90 (patch)
tree5b0bc8269df3b7e2bee1c6c67e50124af20cf4b0
parent4fc52a840c5be7ce72978c3cfca2721e2edc251c (diff)
Declare VirtualInterfaceNames as string array for consistency
-rw-r--r--Jellyfin.Networking/Configuration/NetworkConfiguration.cs2
-rw-r--r--Jellyfin.Networking/Manager/NetworkManager.cs31
-rw-r--r--Jellyfin.Server/Migrations/PreStartupRoutines/CreateNetworkConfiguration.cs2
3 files changed, 21 insertions, 14 deletions
diff --git a/Jellyfin.Networking/Configuration/NetworkConfiguration.cs b/Jellyfin.Networking/Configuration/NetworkConfiguration.cs
index 642af7dda..f90419851 100644
--- a/Jellyfin.Networking/Configuration/NetworkConfiguration.cs
+++ b/Jellyfin.Networking/Configuration/NetworkConfiguration.cs
@@ -150,7 +150,7 @@ namespace Jellyfin.Networking.Configuration
/// <summary>
/// Gets or sets a value indicating the interface name prefixes that should be ignored. The list can be comma separated and values are case-insensitive. <seealso cref="IgnoreVirtualInterfaces"/>.
/// </summary>
- public string VirtualInterfaceNames { get; set; } = "veth";
+ public string[] VirtualInterfaceNames { get; set; } = new string[] { "veth" };
/// <summary>
/// Gets or sets a value indicating whether the published server uri is based on information in HTTP requests.
diff --git a/Jellyfin.Networking/Manager/NetworkManager.cs b/Jellyfin.Networking/Manager/NetworkManager.cs
index 0f8f1a36a..146340989 100644
--- a/Jellyfin.Networking/Manager/NetworkManager.cs
+++ b/Jellyfin.Networking/Manager/NetworkManager.cs
@@ -359,12 +359,11 @@ namespace Jellyfin.Networking.Manager
{
// Remove potentially exisiting * and split config string into prefixes
var virtualInterfacePrefixes = config.VirtualInterfaceNames
- .Replace("*", string.Empty, StringComparison.OrdinalIgnoreCase)
- .ToLowerInvariant()
- .Split(',');
+ .Select(i => i.ToLowerInvariant()
+ .Replace("*", string.Empty, StringComparison.OrdinalIgnoreCase));
// Check all interfaces for matches against the prefixes and remove them
- if (_interfaces.Count > 0 && virtualInterfacePrefixes.Length > 0)
+ if (_interfaces.Count > 0 && virtualInterfacePrefixes.Any())
{
foreach (var virtualInterfacePrefix in virtualInterfacePrefixes)
{
@@ -726,7 +725,15 @@ namespace Jellyfin.Networking.Manager
if (MatchesPublishedServerUrl(source, isExternal, out string res, out port))
{
- _logger.LogInformation("{Source}: Using BindAddress {Address}:{Port}", source, res, port);
+ if (port != null)
+ {
+ _logger.LogInformation("{Source}: Using BindAddress {Address}:{Port}", source, res, port);
+ }
+ else
+ {
+ _logger.LogInformation("{Source}: Using BindAddress {Address}", source, res);
+ }
+
return res;
}
@@ -756,7 +763,7 @@ namespace Jellyfin.Networking.Manager
if (intf.Address.Equals(source))
{
result = NetworkExtensions.FormatIpString(intf.Address);
- _logger.LogDebug("{Source}: GetBindInterface: Has found matching interface. {Result}", source, result);
+ _logger.LogDebug("{Source}: GetBindInterface: Has found matching interface: {Result}", source, result);
return result;
}
}
@@ -768,14 +775,14 @@ namespace Jellyfin.Networking.Manager
if (intf.Subnet.Contains(source))
{
result = NetworkExtensions.FormatIpString(intf.Address);
- _logger.LogDebug("{Source}: GetBindInterface: Has source, matched best internal interface on range. {Result}", source, result);
+ _logger.LogDebug("{Source}: GetBindInterface: Has source, matched best internal interface on range: {Result}", source, result);
return result;
}
}
}
result = NetworkExtensions.FormatIpString(availableInterfaces.First().Address);
- _logger.LogDebug("{Source}: GetBindInterface: Matched first internal interface. {Result}", source, result);
+ _logger.LogDebug("{Source}: GetBindInterface: Matched first internal interface: {Result}", source, result);
return result;
}
@@ -956,7 +963,7 @@ namespace Jellyfin.Networking.Manager
if (bindAddress != null)
{
result = NetworkExtensions.FormatIpString(bindAddress);
- _logger.LogDebug("{Source}: GetBindInterface: Has source, found a matching external bind interface. {Result}", source, result);
+ _logger.LogDebug("{Source}: GetBindInterface: Has source, found a matching external bind interface: {Result}", source, result);
return true;
}
}
@@ -976,7 +983,7 @@ namespace Jellyfin.Networking.Manager
if (bindAddress != null)
{
result = NetworkExtensions.FormatIpString(bindAddress);
- _logger.LogWarning("{Source}: Request received, matching internal interface bind found. {Result}", source, result);
+ _logger.LogWarning("{Source}: Request received, matching internal interface bind found: {Result}", source, result);
return true;
}
}
@@ -1006,7 +1013,7 @@ namespace Jellyfin.Networking.Manager
if (!IsInLocalNetwork(intf.Address) && intf.Subnet.Contains(source))
{
result = NetworkExtensions.FormatIpString(intf.Address);
- _logger.LogDebug("{Source}: GetBindInterface: Selected best external on interface on range. {Result}", source, result);
+ _logger.LogDebug("{Source}: GetBindInterface: Selected best external on interface on range: {Result}", source, result);
return true;
}
}
@@ -1014,7 +1021,7 @@ namespace Jellyfin.Networking.Manager
if (hasResult != null)
{
result = NetworkExtensions.FormatIpString(hasResult);
- _logger.LogDebug("{Source}: GetBindInterface: Selected first external interface. {Result}", source, result);
+ _logger.LogDebug("{Source}: GetBindInterface: Selected first external interface: {Result}", source, result);
return true;
}
diff --git a/Jellyfin.Server/Migrations/PreStartupRoutines/CreateNetworkConfiguration.cs b/Jellyfin.Server/Migrations/PreStartupRoutines/CreateNetworkConfiguration.cs
index b67017281..2c2715526 100644
--- a/Jellyfin.Server/Migrations/PreStartupRoutines/CreateNetworkConfiguration.cs
+++ b/Jellyfin.Server/Migrations/PreStartupRoutines/CreateNetworkConfiguration.cs
@@ -114,7 +114,7 @@ public class CreateNetworkConfiguration : IMigrationRoutine
public bool IgnoreVirtualInterfaces { get; set; } = true;
- public string VirtualInterfaceNames { get; set; } = "veth";
+ public string[] VirtualInterfaceNames { get; set; } = new string[] { "veth" };
public string[] PublishedServerUriBySubnet { get; set; } = Array.Empty<string>();