EthernetAddress.fromInterface returning a WAN miniport address on Win7 64

52 views
Skip to first unread message

Mark Anderson

unread,
Feb 28, 2013, 3:15:43 PM2/28/13
to java-uuid-ge...@googlegroups.com
In checking out JUG for the first time yesterday, I found that the MAC address being returned and assembled into the UUID was not what I was expecting.  isLocallyAdministeredAddress was also returning true, though I don't have a locally administered MAC setup in the registry or on my NIC properties. 

In stepping through the code in debug mode I see that this section of code in EthernetAddress.fromInterface() is returning a WAN Miniport (IPv6) entry on my Windows 7 64 system:

                if (!nint.isLoopback()) {
                    byte[] data = nint.getHardwareAddress();
                    if (data != null && data.length == 6) {
                        return new EthernetAddress(data);
                    }
                }

Evidently the miniport data length is also 6 and was higher in the enumeration than the actual NIC.

Using the following code returns the expected MAC address and when set into EthernetAddress generates the expected UUID:
            InetAddress address = InetAddress.getLocalHost();
            NetworkInterface nwi = NetworkInterface.getByInetAddress(address);
            mac = nwi.getHardwareAddress();

Is this a known issue/bug?  I wasn't able to find anything.

Thanks.

Tatu Saloranta

unread,
Feb 28, 2013, 5:17:10 PM2/28/13
to java-uuid-ge...@googlegroups.com
Interesting. No, I don't think this has been reported. Could you file a bug at

https://github.com/cowtowncoder/java-uuid-generator/issues

It would be nice to have a test case, but that may be hard to create.
I wish there was another way to recognize such interfaces, without
additional lookups.

-+ Tatu +-

Mark Anderson

unread,
Feb 28, 2013, 6:42:19 PM2/28/13
to java-uuid-ge...@googlegroups.com
Thanks.  Opened issue #11 with a bit more detail.

    -Mark

Tatu Saloranta

unread,
Feb 28, 2013, 9:15:15 PM2/28/13
to java-uuid-ge...@googlegroups.com
Thanks!

-+ Tatu +-

On Thu, Feb 28, 2013 at 3:42 PM, Mark Anderson <mark.an...@gmail.com> wrote:
> Thanks. Opened issue #11 with a bit more detail.
>
> -Mark
>
> --
> You received this message because you are subscribed to the Google Groups
> "Java Uuid Generator Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to java-uuid-generato...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
Reply all
Reply to author
Forward
0 new messages