The Free Software Media System - Server Backend & API
improve network address detection
Luke Pulverenti6fe933fde4b0
diff --git a/Emby.Common.Implementations/Networking/NetworkManager.cs b/Emby.Common.Implementations/Networking/NetworkManager.csindex b9100f9db3..a4e6d47d40 100644--- a/Emby.Common.Implementations/Networking/NetworkManager.cs+++ b/Emby.Common.Implementations/Networking/NetworkManager.cs@@ -198,6 +198,12 @@ namespace Emby.Common.Implementations.Networkingreturn Dns.GetHostAddressesAsync(hostName);}+ private readonly List<NetworkInterfaceType> _validNetworkInterfaceTypes = new List<NetworkInterfaceType>+ {+ NetworkInterfaceType.Ethernet,+ NetworkInterfaceType.Wireless80211+ };+private List<IPAddress> GetIPsDefault(){NetworkInterface[] interfaces;@@ -223,9 +229,22 @@ namespace Emby.Common.Implementations.Networking{Logger.Debug("Querying interface: {0}. Type: {1}. Status: {2}", network.Name, network.NetworkInterfaceType, network.OperationalStatus);- var properties = network.GetIPProperties();+ var ipProperties = network.GetIPProperties();++ // Try to exclude virtual adapters+ // http://stackoverflow.com/questions/8089685/c-sharp-finding-my-machines-local-ip-address-and-not-the-vms+ var addr = ipProperties.GatewayAddresses.FirstOrDefault();+ if (addr == null|| string.Equals(addr.Address.ToString(), "0.0.0.0", StringComparison.OrdinalIgnoreCase))+ {+ return new List<IPAddress>();+ }++ //if (!_validNetworkInterfaceTypes.Contains(network.NetworkInterfaceType))+ //{+ // return new List<IPAddress>();+ //}- return properties.UnicastAddresses+ return ipProperties.UnicastAddresses.Where(i => i.IsDnsEligible).Select(i => i.Address).Where(i => i.AddressFamily == AddressFamily.InterNetwork)diff --git a/src/Emby.Server/Emby.Server.xproj b/src/Emby.Server/Emby.Server.xprojindex 6a23809ced..2462c5179f 100644--- a/src/Emby.Server/Emby.Server.xproj+++ b/src/Emby.Server/Emby.Server.xproj@@ -37,5 +37,10 @@<ProjectReference Include="..\..\ServiceStack\ServiceStack.csproj" /><ProjectReference Include="..\..\SocketHttpListener.Portable\SocketHttpListener.Portable.csproj" /></ItemGroup>+ <ItemGroup>+ <Compile Include="..\..\SharedVersion.cs">+ <Link>Properties\SharedVersion.cs</Link>+ </Compile>+ </ItemGroup><Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" /></Project>\ No newline at end of filediff --git a/src/Emby.Server/project.json b/src/Emby.Server/project.jsonindex 5b64beae61..852c7d519d 100644--- a/src/Emby.Server/project.json+++ b/src/Emby.Server/project.json@@ -1,5 +1,5 @@{- "version": "1.0.0-*",+ "version": "3.1.0-*","buildOptions": {"emitEntryPoint": true},@@ -33,8 +33,26 @@"win10-arm64": {},"osx.10.10-x64": {},"osx.10.11-x64": {},- "osx.10.12-x64": {},- "ubuntu.14.04-x64": {}+ "osx.10.12-x64": ,+ "rhel.7.0-x64": {},+ "rhel.7.1-x64": {},+ "rhel.7.2-x64": {},+ "ubuntu.14.04-x64": {},+ "ubuntu.14.10-x64": {},+ "ubuntu.15.04-x64": {},+ "ubuntu.15.10-x64": {},+ "ubuntu.16.04-x64": {},+ "ubuntu.16.10-x64": {},+ "centos.7-x64": {},+ "debian.8-x64": {},+ "fedora.23-x64": {},+ "fedora.24-x64": {},+ "opensuse.13.2-x64": {},+ "opensuse.42.1-x64": {},+ "ol.7-x64": {},+ "ol.7.0-x64": {},+ "ol.7.1-x64": {},+ "ol.7.2-x64": {}},"frameworks": {