CP-11957: ssh console: Add UI elements to launch ssh

If there is at least one IPv4 address, we use that even if it is not the first we have seen (by looking at the VIFs)
This commit is contained in:
Gabor Apati-Nagy 2015-05-07 12:11:17 +01:00
parent af38c2fdf0
commit e53be2d67b

View File

@ -43,6 +43,7 @@ using XenAdmin.Commands;
using XenAdmin.Dialogs;
using System.Collections.Generic;
using System.Diagnostics;
using System.Net;
namespace XenAdmin.ConsoleView
{
@ -1604,6 +1605,13 @@ namespace XenAdmin.ConsoleView
}
}
//find first IPv4 address and return it - we would use it if there is one
IPAddress addr;
foreach (string addrString in ipAddresses)
if (IPAddress.TryParse(addrString, out addr) && addr.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
return addrString;
//return the first address (this will not be IPv4)
return ipAddresses.FirstOrDefault() ?? string.Empty;
}