[Mono-bugs] [Bug 502560] New: Mono.ZeroConf.Providers.Bonjour.Service.UPort

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat May 9 22:38:52 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=502560


           Summary: Mono.ZeroConf.Providers.Bonjour.Service.UPort
    Classification: Mono
           Product: Mono: Class Libraries
           Version: unspecified
          Platform: All
        OS/Version: Windows
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: Mono.Zeroconf
        AssignedTo: abockover at novell.com
        ReportedBy: kjackson at crimebucket.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Development


UPort is broken.

Your code is:

public ushort UPort {
  get { return (ushort)IPAddress.NetworkToHostOrder((int)port); }
  set { port = (ushort)IPAddress.HostToNetworkOrder((int)value); }
}

For a value like 50508 this yields zero:

IPAddress.HostToNetworkOrder((int)50508)
0x4cc50000

(ushort)0x4cc50000
0x0000


You need to shift&mask it if yer going to treat it like an int:

public ushort UPort {
  get { return (ushort)((IPAddress.NetworkToHostOrder((int)port) >> 16) &
0xFFFF); }
  set { port = (ushort)((IPAddress.HostToNetworkOrder((int)value) >> 16) &
0xFFFF); }
}


By the way, seriously... fuck registration. I want to help ya out with a bug
report and I have to register on yet another goddamn website. Fuck Novell
harvesting my email.

-- 
Configure bugmail: http://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