VirtualBox

Changeset 8341 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 23, 2008 7:55:58 PM (17 years ago)
Author:
vboxsync
Message:

NAT: set the MAC address during power-on as well for static IP configurations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/DrvNAT.cpp

    r8340 r8341  
    362362}
    363363
     364/**
     365 * Get the MAC address into the slirp stack.
     366 */
     367static void drvNATSetMac(PDRVNAT pData)
     368{
     369    PDMMAC Mac;
     370    if (pData->pConfig)
     371        pData->pConfig->pfnGetMac(pData->pConfig, &Mac);
     372    slirp_set_ethaddr(pData->pNATState, Mac.au8);
     373}
     374
    364375
    365376/**
     
    371382{
    372383    PDRVNAT pData = PDMINS2DATA(pDrvIns, PDRVNAT);
    373     PDMMAC  Mac;
    374     if (pData->pConfig)
    375         pData->pConfig->pfnGetMac(pData->pConfig, &Mac);
    376     slirp_set_ethaddr(pData->pNATState, Mac.au8);
     384    drvNATSetMac(pData);
    377385    return VINF_SUCCESS;
     386}
     387
     388
     389/**
     390 * Some guests might not use DHCP to retrieve an IP but use a static IP.
     391 */
     392static DECLCALLBACK(void) drvNATPowerOn(PPDMDRVINS pDrvIns)
     393{
     394    PDRVNAT pData = PDMINS2DATA(pDrvIns, PDRVNAT);
     395    drvNATSetMac(pData);
    378396}
    379397
     
    557575    NULL,
    558576    /* pfnPowerOn */
    559     NULL,
     577    drvNATPowerOn,
    560578    /* pfnReset */
    561579    NULL,
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