[Mono-bugs] [Bug 386637] New: System.Net.Dns.GetHostAddresses("") returns loopback address

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon May 5 06:27:07 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=386637


           Summary: System.Net.Dns.GetHostAddresses("") returns loopback
                    address
           Product: Mono: Runtime
           Version: 1.9.0
          Platform: Other
        OS/Version: SLES 10
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: io-layer
        AssignedTo: dick at novell.com
        ReportedBy: benoit at zeroc.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Description of Problem:

According to Microsoft documentation passing an empty string to
System.Net.Dns.GetHostAddresses (and GetHostByName/GetHostEntry) returns the
addresses of the local host. Instead, mono returns the address of the loopback
interface.

While I can use System.Net.Dns.GetHostAddresses(System.Net.Dns.GetHostname())
to get the local IP addresses, I don't believe this is a documented behavior
and this doesn't work on platforms where the hostname is incorrectly setup (I
get a "System.Net.Sockets.SocketException: No such host is known").


Steps to reproduce the problem:
1. Compile and run:

    using System.Net;
    public class main
    {
        public static void Main(string[] args)
        {
            foreach(IPAddress a in Dns.GetHostAddresses(""))
            {
                System.Console.WriteLine(a);
            }
        }
    }       

Actual Results:

127.0.0.1

Expected Results:

IP addresses of the local host.

How often does this happen? 

Always.


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list