Opened 4 years ago

Closed 4 years ago

#14 closed task (fixed)

Provide native implementation for java.net.NetworkInterface

Reported by: dmik Owned by:
Priority: major Milestone: Core
Component: general Version:
Severity: Keywords:
Cc:

Description

Odin32 lacks both iphlpapi.dll and the corresponding registry entries (HKLM\Enum and others) that are used by the Windows implementation of native methods for the NetworkInterface? class.
We have to find a solution that works on OS/2. Most likely it will be the native OS/2 TCP/IP calls.

Change History (7)

comment:1 Changed 4 years ago by dmik

Using the OS/2 TCP/IP calls may actually be problematic because we already use Winsock2 from Odin32 for TCP/IP sockets and I'm not sure that the latter expose the former directly (e.g. at file descriptor level). Need to check this.

comment:2 Changed 4 years ago by dmik

From what I see, there is a direct correspondene between Winsock/Odin32 and OS/2 TCP/IP DLL socket descriptors. On the other hand, kLIBC seems to use its own descriptor space so they are not directly compatible. It means that we have two choices:

  1. Drop Winsock at all and use kLIBC for sockets.
  2. To enumerate interfaces, use the APIs from the OS/2 TCP/IP DLL directly.

I will first try the latter approach as Winsock seems to be used a lot across various Windows-specific sources and it will require more work to get rid of it.

comment:3 Changed 4 years ago by dmik

Winsock interferes so much with the socket stuff in LIBC that there is no way to use them both within the same header. I will have to copy the relevant definitions from the kLIBC headers and place them into the source. We will bypass kLIBC own socket APIs and will use forwarders to tcpip32.dll it provides instead.

comment:4 Changed 4 years ago by dmik

After the second look, I think that the most optimal solution will be to provide a simplified version of iphlpapi.dll in Odin. For IPv4, we only need to export these three functions:

GetIpAddrTable
GetIfTable
GetFriendlyIfIndex

I will try to take them from Wine (see http://source.winehq.org/source/dlls/iphlpapi/iphlpapi_main.c and friend) and adopt to OS/2.

comment:5 Changed 4 years ago by dmik

Actually, there is a non-Wine implementation of iphlpapi.dll that contains exactly what we need. Which is not a surprise since Odin already was used to port Win32 JDK in the past. I will use this existing implementation.

comment:6 Changed 4 years ago by dmik

The existing Odin implementation of iphlpapi.dll was revised, checked and fixed in the Odin SVN.

comment:7 Changed 4 years ago by dmik

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.