VirtualBox

Ignore:
Timestamp:
Jan 27, 2009 9:13:47 AM (16 years ago)
Author:
vboxsync
Message:

HostNetIf API: Fixed UUID generation for host network interfaces on Linux.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/linux/NetIfList-linux.cpp

    r15936 r16251  
    5858                break;
    5959        }
    60         /* Pick up some garbage from stack. */
     60        /* Generate UUID from name and MAC address. */
    6161        RTUUID uuid;
    62         Assert(sizeof(uuid) <= sizeof(Req));
     62        RTUuidClear(&uuid);
     63        memcpy(&uuid, Req.ifr_name, RT_MIN(sizeof(Req.ifr_name), sizeof(uuid)));
     64        uuid.Gen.u8ClockSeqHiAndReserved = (uuid.Gen.u8ClockSeqHiAndReserved & 0x3f) | 0x80;
     65        uuid.Gen.u16TimeHiAndVersion = (uuid.Gen.u16TimeHiAndVersion & 0x0fff) | 0x4000;
    6366        memcpy(uuid.Gen.au8Node, &Req.ifr_hwaddr.sa_data, sizeof(uuid.Gen.au8Node));
    6467        pInfo->Uuid = uuid;
     68
    6569        memcpy(&pInfo->MACAddress, Req.ifr_hwaddr.sa_data, sizeof(pInfo->MACAddress));
    6670
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette