MulticastSocket problem on FreeBSD

Oliver Lehmann lehmann at
Thu Jan 31 10:26:29 PST 2013


I encountered a bug while migrating from FreeBSDs old "Diablo jre"
to openjdk-jre version 6.

I'm running a software using multicast communication and it fails
on FreeBSD when using openjdk6.

example code:


class Main {
   static String hostname = new String("");

   public static void main(String args[]) throws
       SocketException, UnknownHostException, IOException{
     InetAddress ia = InetAddress.getByName(hostname);
     MulticastSocket ssdpSocket = new MulticastSocket();


     System.out.println("network interface: " +
     System.out.println("interface: " + ssdpSocket.getInterface());

The output of the old "Diablo JRE" is:

   network interface: name:null index: -1 addresses:

   interface: /

The output of openJDK6 is:

   network interface: name:null
   interface: /

It always returns this information.
For comparison - openjdk on Linux:

   network interface: name:eth0 (eth0)
   interface: /

Oracle 7 VM on Windows:

   network interface: name:eth3 (Realtek PCIe GBE Family Controller)
   interface: /

For me this seems to be an implementation bug of... I don't know?
PlainDatagramSocketImpl.c maybe?

I tried to debug this further, but did not succeeded to find out if
either setInterface() failed to set it correctly, or somewhere in
getInterface() an early return() happens. I tried to remotly debug
this using Eclipse, but only saw the private variables of ssdpSocket
which didn't indicated something obvious. Breakpoints inside would have helped ;)

More information about the bsd-port-dev mailing list