mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-25 14:27:26 +01:00
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:
parent
af38c2fdf0
commit
e53be2d67b
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user