I used the uuid command from the uuid-1.6.2-8.fc17.x86_64 package to generate version 1 UUIDs. The man page said that the default is to use the real MAC address of the host, but when I decoded the generated UUID, it is using the local multicast address. uuid v 1 shows:


Decoding with uuid -d 5fc2d464-e1f8-11e1-9c3d-ff8beec65651 shows:

encode: STR:     c7ee12de-e1f7-11e1-99f1-53d638ec6296
        SIV:     265752520555487307909286258714002350742
decode: variant: DCE 1.1, ISO/IEC 11578:1996
        version: 1 (time and node based)
        content: time:  2012-08-09 07:56:52.526563.0 UTC
                 clock: 6641 (usually random)
                 node:  53:d6:38:ec:62:96 (local multicast)

How can I make it use my actual MAC address, and my time zone (Asia/Tehran, not UTC)?


The reason it's not using your actual MAC address is because the code is poorly written. The mac_address function in uuid_mac.c has this block of code:

    if ((s = socket(PF_INET, SOCK_DGRAM, 0)) < 0)
        return FALSE;
    sprintf(ifr.ifr_name, "eth0");
    if (ioctl(s, SIOCGIFHWADDR, &ifr) < 0) {
        return FALSE;

It's looking for the MAC address of the eth0 interface, and silently falling back to a randomly-generated local multicast address if it can't find it. If your network interface is called eth1 or wlan0 or anything else, it fails to find it.

I would consider this a bug in the software. It should use the MAC address of the hardware interface corresponding to the current default route, and let the user specify an alternate interface if desired. I'd recommend reporting that upstream.

Regarding timezone: the UUID doesn't store the timezone. The time information in the UUID is stored as UTC time, and so that's how uuid -d displays it. An enhancement to the uuid program might be to provide an option to display times according to the local timezone when decoding -- but either way, that info doesn't get stored inside the UUID itself.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.