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

Rich DiCroce duke at openjdk.org
Thu Feb 16 18:07:30 UTC 2023


On Thu, 16 Feb 2023 17:08:25 GMT, Daniel Jeliński <djelinski at openjdk.org> wrote:

>> Rich DiCroce has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Limit line length to 80-ish characters
>
> src/java.base/windows/native/libnet/NetworkInterface.c line 523:
> 
>> 521:  * Signature: (Ljava/lang/String;I)Z
>> 522:  */
>> 523: JNIEXPORT jboolean JNICALL Java_java_net_NetworkInterface_supportsMulticast0(JNIEnv *env, jclass cls, jstring name, jint index) {
> 
> I'm not a big fan of using WBEM here. Also, I'm still trying to figure out when (if ever) this method is supposed to return false

You and me both. As I wrote in the giant comment, I did a lot of experimenting. In the end, what I determined was that if the IGMPLevel (IPv4) or MldLevel (IPv6) is set to 0 (None), then attempting to join a multicast group throws an exception. So that seemed like a reasonable thing that supportsMulticast() could measure. Nothing else I tried, including the existing GetAdaptersAddresses approach, indicated that multicast was disabled in those situations.

Having said that, I'd be okay with ditching all of this code and just returning true unconditionally. It's unlikely that multicast would be disabled, and a single boolean isn't enough to express the actual setting anyway, since Windows apparently lets you disable receiving multicasts while still allowing you to send them.

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

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



More information about the build-dev mailing list