Changeset 8285 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Apr 22, 2008 1:04:46 PM (17 years ago)
- Location:
- trunk/src/VBox/Devices/Network
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DrvNAT.cpp
r8155 r8285 48 48 /** The port we're attached to. */ 49 49 PPDMINETWORKPORT pPort; 50 /** The network config of the port we're attached to. */ 51 PPDMINETWORKCONFIG pConfig; 50 52 /** Pointer to the driver instance. */ 51 53 PPDMDRVINS pDrvIns; … … 88 90 static DECLCALLBACK(int) drvNATSend(PPDMINETWORKCONNECTOR pInterface, const void *pvBuf, size_t cb) 89 91 { 90 PDRVNAT 92 PDRVNAT pData = PDMINETWORKCONNECTOR_2_DRVNAT(pInterface); 91 93 92 94 LogFlow(("drvNATSend: pvBuf=%p cb=%#x\n", pvBuf, cb)); … … 133 135 static DECLCALLBACK(void) drvNATNotifyLinkChanged(PPDMINETWORKCONNECTOR pInterface, PDMNETWORKLINKSTATE enmLinkState) 134 136 { 135 PDRVNAT 137 PDRVNAT pData = PDMINETWORKCONNECTOR_2_DRVNAT(pInterface); 136 138 137 139 LogFlow(("drvNATNotifyLinkChanged: enmLinkState=%d\n", enmLinkState)); … … 359 361 } 360 362 363 static DECLCALLBACK(int) drvNATLoadDone(PPDMDRVINS pDrvIns, PSSMHANDLE pSSMHandle) 364 { 365 PDRVNAT pData = PDMINS2DATA(pDrvIns, PDRVNAT); 366 PDMMAC Mac; 367 if (pData->pConfig) 368 pData->pConfig->pfnGetMac(pData->pConfig, &Mac); 369 slirp_set_ethaddr(pData->pNATState, Mac.au8); 370 return VINF_SUCCESS; 371 } 372 361 373 362 374 /** … … 420 432 return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_MISSING_INTERFACE_ABOVE, 421 433 N_("Configuration error: the above device/driver didn't export the network port interface")); 434 pData->pConfig = (PPDMINETWORKCONFIG)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_NETWORK_CONFIG); 435 if (!pData->pConfig) 436 return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_MISSING_INTERFACE_ABOVE, 437 N_("Configuration error: the above device/driver didn't export the network config interface")); 422 438 423 439 /* Generate a network address for this network card. */ … … 451 467 if (VBOX_SUCCESS(rc2)) 452 468 { 469 rc2 = pDrvIns->pDrvHlp->pfnSSMRegister(pDrvIns, pDrvIns->pDrvReg->szDriverName, 0, 0, 470 pDrvIns->iInstance, NULL, NULL, NULL, NULL, NULL, 471 drvNATLoadDone); 472 AssertRC(rc2); 453 473 pDrvIns->pDrvHlp->pfnPDMPollerRegister(pDrvIns, drvNATPoller); 454 474 … … 462 482 } 463 483 /* failure path */ 484 rc = rc2; 464 485 slirp_term(pData->pNATState); 465 486 pData->pNATState = NULL; -
trunk/src/VBox/Devices/Network/slirp/libslirp.h
r8009 r8285 38 38 39 39 void slirp_input(PNATState pData, const uint8_t *pkt, int pkt_len); 40 void slirp_set_ethaddr(PNATState pData, const uint8_t *ethaddr); 40 41 41 42 /* you must provide the following functions: */ -
trunk/src/VBox/Devices/Network/slirp/slirp.c
r8009 r8285 812 812 addr_low_byte, htons(guest_port)); 813 813 } 814 815 void slirp_set_ethaddr(PNATState pData, const uint8_t *ethaddr) 816 { 817 memcpy(client_ethaddr, ethaddr, ETH_ALEN); 818 }
Note:
See TracChangeset
for help on using the changeset viewer.