hg: jdk7/jsn/jdk: 6717876: Make java.net.NetworkInterface.getIndex() public

Mark Wielaard mark at klomp.org
Thu Aug 28 09:10:30 PDT 2008


On Thu, 2008-08-28 at 12:16 +0100, Alan Bateman wrote:
> Mark Wielaard wrote:
> > :
> > This seems to introduce a new public API in the java.net package.
> > I was wondering how that works for someone that wants to introduce
> > such things in openjdk. 
> There is still some infrastructure and process that isn't externalized 
> yet. The change approval process for API additions and behavior changes 
> is one of them. In the interim, this means finding a buddy or sponsor to 
> work with when proposing updates to APIs. I'm happy to act as a proxy in 
> the interim and I'm sure others are too.

Thanks. On irc I was pointed to "CCC" review board which currently is
"under construction": http://openjdk.java.net/guide/reviewBodies.html
and not planned to be made public till 2008/Q2. Would it be possible to
publish a summary whenever such a CCC has occurred to the
announce/discuss list till then? Just something simple like "The CCC
received a request from X for public interface change Y with as
justification Z. The CCC process ended in an Approval/Disapproval for
the following reason...". Then at least these kind of changes don't just
have a commit without any public discussion.

> > I might be reading this wrongly but it seems the only thing this API
> > does is expose some random internal "index" numbers for an
> > NetworkInterface. Seeing that there are no guarantees on whether there
> > are index numbers in the first place for any or all interfaces it seems
> > not that useful imho. An example of how an application would use this
> > new interface would be nice to get a better idea in what situations
> > this would be used.
> >   
> Jessie is the best person to answer this but if my memory is correct, 
> exposing the index was first discussed back in 1.4 as part of the API 
> changes required to support IPv6. The index is mostly used to identify 
> the interface when doing IPv6 multicasting and the getByIndex/getIndex 
> methods were to be the approximate equivalent of RFC 2133's 
> if_nametoindex and if_indextoname. In jdk5 the IPv6 support was updated 
> to support IPv6 scoped addresses. This is important to disambiguate the 
> destination when there are multiple interfaces and hosts with non-global 
> addresses. Typically the scope identifier is the interface index so it 
> has been exposed since jdk5. Jessie's updates, while niche, go further 
> to completing this API.

Aha. OK. I might be dense, but I don't think I am the only person not
immediately making the link between these methods and the RFC 2133
"Interface Identification" and how they are used as described in RFC
2292 for selecting the outgoing interface. So a pointer to this in the
documentation might be helpful. Also an small code example how to
actually use these interface identifiers would help make the interface
more clear. So I assume the Index returned can be used as an Scope
identifier when creating a Inet6Address. In that case it would be good
to mention that in the documentation also. And maybe even change the
method name (if not too late) to getScopeIndex() or something a bit more
descriptive.

Cheers,

Mark




More information about the net-dev mailing list