RFR 8216417: cleanup of IPv6 scope-id handling

Michael McMahon michael.x.mcmahon at oracle.com
Tue Jun 11 11:11:34 UTC 2019


Thanks for the review Alan.
I've made the changes suggested by you and Daniel
and added a test to Scoping.java for checking the connected IP address.

http://cr.openjdk.java.net/~michaelm/8216417/webrev.3/index.html

- Michael


On 10/06/2019, 16:49, Alan Bateman wrote:
> On 10/06/2019 15:18, Michael McMahon wrote:
>> Hi,
>>
>> Could I get the following change to net/nio reviewed please?
>>
>> It is a general cleanup of IPv6 scope_id handling which removes
>> a lot of native code trickery (mostly in Linux) and simplifies the 
>> handling
>> of scope_ids such that:
>>
>> a) when binding/connecting/sending to a link-local address on the 
>> same machine,
>>    it is allowed to use addresses without a scope_id. In this case, 
>> we check local NetworkInterfaces
>>    for the correct scope_id to use.
>>
>> b) when connecting/sending to a remote link-local address, then a 
>> scope_id must be specified
>>     at all times.
>>
>> Scope_ids should be handled consistently between net and NIO and 
>> across all platforms now.
>>
>> http://cr.openjdk.java.net/~michaelm/8216417/webrev.2/index.html
> This looks like a really good cleanup.
>
> One thing I notice is that AbstractPlainSocketImpl.connect sets 
> this.address before converting it to the scoped address. This impacts 
> the address returned by Socket::getInetAddress so I think it needs to 
> set this.address first.
>
> DatagramChannel.send will need to use 
> toScopeAddress(InetSocketAddress) for the "not connected" case, 
> probably after the SM check. There is probably a slightly bigger 
> question here on on SM checks and  whether it's interesting to have 
> the scope ID in the address or not. Long standing behavior seems to be 
> to call the SM with the address that the user has specified and this 
> may or may not include the scope ID.
>
> -Alan
>


More information about the nio-dev mailing list