Sfoglia il codice sorgente

Take subnet size into account

Tim Eisele 4 mesi fa
parent
commit
e6c6441abf
1 ha cambiato i file con 2 aggiunte e 0 eliminazioni
  1. 2 0
      src/Jellyfin.Networking/Manager/NetworkManager.cs

+ 2 - 0
src/Jellyfin.Networking/Manager/NetworkManager.cs

@@ -1066,6 +1066,7 @@ public class NetworkManager : INetworkManager, IDisposable
                 // If none exists, this will select the first external interface if there is one.
                 bindAddress = externalInterfaces
                     .OrderByDescending(x => x.Subnet.Contains(source))
+                    .ThenByDescending(x => x.Subnet.PrefixLength)
                     .ThenBy(x => x.Index)
                     .Select(x => x.Address)
                     .First();
@@ -1083,6 +1084,7 @@ public class NetworkManager : INetworkManager, IDisposable
             // If none exists, this will select the first internal interface if there is one.
             bindAddress = _interfaces.Where(x => IsInLocalNetwork(x.Address))
                 .OrderByDescending(x => x.Subnet.Contains(source))
+                .ThenByDescending(x => x.Subnet.PrefixLength)
                 .ThenBy(x => x.Index)
                 .Select(x => x.Address)
                 .FirstOrDefault();