Skip to content

Commit

Permalink
CA-280679: Fixed issue where the TabPage plugin could not handle Ipv6…
Browse files Browse the repository at this point in the history
… addresses.

Signed-off-by: Konstantina Chremmou <[email protected]>
  • Loading branch information
kc284 authored and MihaelaStoica committed Jan 29, 2018
1 parent 1febd6f commit 19de8c5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 9 additions & 1 deletion XenAdmin/Plugins/Placeholders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
using XenCenterLib;
using XenAdmin.XenSearch;
using XenAPI;
using System.Net.Sockets;

namespace XenAdmin.Plugins
{
Expand Down Expand Up @@ -191,7 +192,14 @@ public static List<Uri> SubstituteUri(string uri, IXenObject obj)
return new List<Uri> { new Uri(u) };
}

return ips.ConvertAll(ip => new Uri(u.Replace(string.Format(PlaceholderFormat, ipAddressName), ip.ToString())));
return ips.ConvertAll(ip =>
{
var ipstring = ip.AddressIP != null && ip.AddressIP.AddressFamily == AddressFamily.InterNetworkV6
? string.Format("[{0}]", ip)
: ip.ToString();

return new Uri(u.Replace(string.Format(PlaceholderFormat, ipAddressName), ipstring));
});
}
catch (UriFormatException)
{
Expand Down
2 changes: 2 additions & 0 deletions XenCenterLib/ComparableAddress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ private bool IsPartialIP
get { return partialIP != null; }
}

public IPAddress AddressIP { get { return addressIP; } }

public static bool TryParse(String candidate, bool allowPartialIP, bool allowName, out ComparableAddress address)
{
address = null;
Expand Down

0 comments on commit 19de8c5

Please sign in to comment.