From daf2340d47d6983a627949ff96054b6f7b392fb5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexander=20K=C3=B6plinger?= Date: Sat, 1 Feb 2014 22:02:27 +0100 Subject: [PATCH] [System] Fixed an error in the implementation of System.Net.IPAddress.IsIPv6Teredo The property was introduced with PR #870 but it missed to convert network byte order to host byte order, so the comparison wasn't working correctly and the corresponding unit test failed. @marek-safar erroneously "fixed" the test in 27e07c7. This is the corrected implementation and the original test now works as intended. --- mcs/class/System/System.Net/IPAddress.cs | 2 +- mcs/class/System/Test/System.Net/IPAddressTest.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mcs/class/System/System.Net/IPAddress.cs b/mcs/class/System/System.Net/IPAddress.cs index b1081f5bd29..92c0f8e6e07 100644 --- a/mcs/class/System/System.Net/IPAddress.cs +++ b/mcs/class/System/System.Net/IPAddress.cs @@ -337,7 +337,7 @@ namespace System.Net { public bool IsIPv6Teredo { get { return m_Family != AddressFamily.InterNetwork && - m_Numbers[0] == 0x2001 && + NetworkToHostOrder ((short) m_Numbers [0]) == 0x2001 && m_Numbers[1] == 0; } } diff --git a/mcs/class/System/Test/System.Net/IPAddressTest.cs b/mcs/class/System/Test/System.Net/IPAddressTest.cs index 505bdfb881c..a07c1a19d92 100644 --- a/mcs/class/System/Test/System.Net/IPAddressTest.cs +++ b/mcs/class/System/Test/System.Net/IPAddressTest.cs @@ -550,7 +550,7 @@ public class IPAddressTest [Test] public void IsIPv6Teredo () { - Assert.IsFalse (IPAddress.Parse ("2001::1").IsIPv6Teredo, "#1"); + Assert.IsTrue (IPAddress.Parse ("2001::1").IsIPv6Teredo, "#1"); Assert.IsFalse (IPAddress.Parse ("2002::1").IsIPv6Teredo, "#2"); } #endif -- 2.25.1