RFR: 8302659: Modernize Windows native code for NetworkInterface [v2]

Daniel Jeliński djelinski at openjdk.org
Fri Feb 17 21:01:28 UTC 2023


On Thu, 16 Feb 2023 17:56:58 GMT, Rich DiCroce <duke at openjdk.org> wrote:

>> src/java.base/windows/native/libnet/NetworkInterface.c line 72:
>> 
>>> 70:         return FALSE;
>>> 71:     }
>>> 72:     if (GetAnycastIpAddressTable(addrFamily, anyAddrs) != NO_ERROR) {
>> 
>> Were the anycast addresses covered by the existing code, or is this a functional change?
>
> For the IPv6 code, this should be the same as before. See getAddrsFromAdapter in the original code, which enumerates the unicast addresses first and then does the anycast addresses.
> 
> For IPv4, I'm not sure. The MS docs for GetIpAddrTable don't say, and I don't have any systems where I could determine it experimentally.

I tried creating an anycast address using the [CreateAnycastIpAddressEntry API](https://learn.microsoft.com/en-us/windows/win32/api/netioapi/nf-netioapi-createanycastipaddressentry) and the [New-NetIPAddress Powershell command](https://learn.microsoft.com/en-us/powershell/module/nettcpip/new-netipaddress?view=windowsserver2022-ps), but I only managed to lock myself out from a VM; creating the address failed with ERROR_NOT_SUPPORTED, and the powershell command additionally disabled DHCP on the selected interface.

With that in mind I'm fine with the code in its current form. We may revisit the issue if and when someone figures out how to add an anycast address.

-------------

PR: https://git.openjdk.org/jdk/pull/12593



More information about the build-dev mailing list