VirtualBox

Changeset 16870 in vbox for trunk/src


Ignore:
Timestamp:
Feb 17, 2009 5:44:08 PM (16 years ago)
Author:
vboxsync
Message:

Solaris/VBoxNetAdp: random MAC address

Location:
trunk/src/VBox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetAdp/solaris/VBoxNetAdp-solaris.c

    r16855 r16870  
    3636#include <iprt/assert.h>
    3737#include <iprt/mem.h>
    38 #include <iprt/uuid.h>
     38#include <iprt/rand.h>
    3939
    4040#include <sys/types.h>
     
    353353                         * When we implement jumbo frames we should probably retry with MTU 1500 for S10.
    354354                         */
    355                         LogRel((DEVICE_NAME ":VBoxNetAdpSolarisAttach here.\n"));
    356355                        rc = gld_register(pDip, (char *)ddi_driver_name(pDip), pMacInfo);
    357356                        if (rc == DDI_SUCCESS)
     
    482481    pMac->au8[1] = 0x08;
    483482    pMac->au8[2] = 0x27;
    484     pMac->au8[3] = 0x00;
    485     pMac->au8[4] = 0x00;
    486     pMac->au8[5] = 0x00;
    487 
    488     LogFlow((DEVICE_NAME ":VBoxNetAdpSolarisGenerateMac Generated %.6Rhxs\n", pMac));
     483
     484    unsigned char achRand[3];
     485    RTRandBytes(&achRand, sizeof(achRand));
     486
     487    pMac->au8[3] = achRand[0];
     488    pMac->au8[4] = achRand[1];
     489    pMac->au8[5] = achRand[2];
     490
     491    LogFlow((DEVICE_NAME ":VBoxNetAdpSolarisGenerateMac Generated %.*Rhxs\n", sizeof(RTMAC), &pMac));
    489492    return VINF_SUCCESS;
    490493}
     
    493496static int vboxNetAdpSolarisSetMacAddress(gld_mac_info_t *pMacInfo, unsigned char *pszMacAddr)
    494497{
    495 
     498    vboxnetadp_state_t *pState = (vboxnetadp_state_t *)pMacInfo->gldm_private;
     499    if (pState)
     500    {
     501        bcopy(pszMacAddr, &pState->CurrentMac, sizeof(RTMAC));
     502        LogFlow((DEVICE_NAME ":vboxNetAdpSolarisSetMacAddress updated MAC %.*Rhxs\n", sizeof(RTMAC), &pState->CurrentMac));
     503        return GLD_SUCCESS;
     504    }
     505    else
     506        LogRel((DEVICE_NAME ":vboxNetAdpSolarisSetMacAddress failed to get internal state.\n"));
     507    return GLD_FAILURE;
    496508}
    497509
     
    512524static int vboxNetAdpSolarisSetMulticast(gld_mac_info_t *pMacInfo, unsigned char *pMulticastAddr, int fMulticast)
    513525{
    514 
     526    NOREF(pMacInfo);
     527    NOREF(pMulticastAddr);
     528    NOREF(fMulticast);
     529    return GLD_SUCCESS;
    515530}
    516531
  • trunk/src/VBox/Runtime/Makefile.kmk

    r16826 r16870  
    12341234        common/err/RTErrConvertToErrno.cpp \
    12351235        common/misc/thread.cpp \
     1236        common/misc/once.cpp \
    12361237        common/string/memchr.asm \
     1238        common/rand/rand.cpp \
     1239        common/rand/randadv.cpp \
     1240        common/rand/randparkmiller.cpp \
    12371241        generic/RTAssertShouldPanic-generic.cpp \
    12381242        generic/RTLogWriteStdOut-stub-generic.cpp \
    12391243        generic/RTTimerCreate-generic.cpp \
     1244        generic/RTRandAdvCreateSystemFaster-generic.cpp \
    12401245        generic/mppresent-generic.cpp \
    12411246        r0drv/memobj-r0drv.cpp \
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