Changeset 1599 in vbox
- Timestamp:
- Mar 21, 2007 3:25:35 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 19713
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/intnet.h
r1 r1599 215 215 /** The size of the receive buffer. (input) */ 216 216 uint32_t cbRecv; 217 /** check access? */ 218 bool fRestrictAccess; 217 219 /** The handle to the network interface. (output) */ 218 220 INTNETIFHANDLE hIf; … … 325 327 * @param pIntNet The 326 328 */ 327 INTNETR0DECL(int) INTNETR0Open(PINTNET pIntNet, PSUPDRVSESSION pSession, const char *pszNetwork, unsigned cbSend, unsigned cbRecv, PINTNETIFHANDLE phIf);329 INTNETR0DECL(int) INTNETR0Open(PINTNET pIntNet, PSUPDRVSESSION pSession, const char *pszNetwork, unsigned cbSend, unsigned cbRecv, bool fRestrictAccess, PINTNETIFHANDLE phIf); 328 330 329 331 /** -
trunk/src/VBox/Devices/Network/DrvIntNet.cpp
r1005 r1599 618 618 * Validate the config. 619 619 */ 620 if (!CFGMR3AreValuesValid(pCfgHandle, "Network\0ReceiveBufferSize\0SendBufferSize\0 "))620 if (!CFGMR3AreValuesValid(pCfgHandle, "Network\0ReceiveBufferSize\0SendBufferSize\0RestrictAccess\0")) 621 621 return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES; 622 622 … … 648 648 rc = CFGMR3QueryString(pCfgHandle, "Network", OpenArgs.szNetwork, sizeof(OpenArgs.szNetwork)); 649 649 if (VBOX_FAILURE(rc)) 650 { 651 AssertMsgFailed(("Configuration error: query for \"Network\" string return %Vra.\n", rc)); 652 return rc; 653 } 650 return PDMDRV_SET_ERROR(pDrvIns, rc, 651 N_("Configuration error: Failed to get the \"Network\" value")); 654 652 strcpy(pThis->szNetwork, OpenArgs.szNetwork); 655 653 … … 658 656 OpenArgs.cbRecv = _256K; 659 657 else if (VBOX_FAILURE(rc)) 660 { 661 AssertMsgFailed(("Configuration error: query for \"ReceiveBufferSize\" uint32_t return %Vra.\n", rc)); 662 return rc; 663 } 658 return PDMDRV_SET_ERROR(pDrvIns, rc, 659 N_("Configuration error: Failed to get the \"ReceiveBufferSize\" value")); 664 660 665 661 rc = CFGMR3QueryU32(pCfgHandle, "SendBufferSize", &OpenArgs.cbSend); … … 667 663 OpenArgs.cbSend = _4K; 668 664 else if (VBOX_FAILURE(rc)) 669 { 670 AssertMsgFailed(("Configuration error: query for \"SendBufferSize\" uint32_t return %Vra.\n", rc)); 671 return rc; 672 } 665 return PDMDRV_SET_ERROR(pDrvIns, rc, 666 N_("Configuration error: Failed to get the \"SendBufferSize\" value")); 667 668 rc = CFGMR3QueryBool(pCfgHandle, "RestrictAccess", &OpenArgs.fRestrictAccess); 669 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 670 OpenArgs.fRestrictAccess = true; 671 else if (VBOX_FAILURE(rc)) 672 return PDMDRV_SET_ERROR(pDrvIns, rc, 673 N_("Configuration error: Failed to get the \"RestrictAccess\" value")); 673 674 674 675 /* … … 688 689 rc = pDrvIns->pDrvHlp->pfnSUPCallVMMR0Ex(pDrvIns, VMMR0_DO_INTNET_OPEN, &OpenArgs, sizeof(OpenArgs)); 689 690 if (VBOX_FAILURE(rc)) 690 { 691 AssertMsgFailed(("Failed to open/create the network '%s', cbRecv=%RU32, cbSend=%RU32. rc=%Vrc\n", 692 pThis->szNetwork, OpenArgs.cbRecv, OpenArgs.cbSend, rc)); 693 return rc; 694 } 691 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, 692 N_("Failed to open/create the internal network '%s'"), pThis->szNetwork); 695 693 AssertRelease(OpenArgs.hIf != INTNET_HANDLE_INVALID); 696 694 pThis->hIf = OpenArgs.hIf; … … 705 703 rc = pDrvIns->pDrvHlp->pfnSUPCallVMMR0Ex(pDrvIns, VMMR0_DO_INTNET_IF_GET_RING3_BUFFER, &GetRing3BufferArgs, sizeof(GetRing3BufferArgs)); 706 704 if (VBOX_FAILURE(rc)) 707 { 708 AssertMsgFailed(("Failed to get ring-3 buffer for the newly created interface to '%s'. rc=%Vrc\n", 709 pThis->szNetwork, rc)); 710 return rc; 711 } 705 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, 706 N_("Failed to get ring-3 buffer for the newly created interface to '%s'"), pThis->szNetwork); 712 707 AssertRelease(VALID_PTR(GetRing3BufferArgs.pRing3Buf)); 713 708 pThis->pBuf = GetRing3BufferArgs.pRing3Buf; -
trunk/src/VBox/Devices/Network/SrvIntNetR0.cpp
r1482 r1599 103 103 /** The SUPR0 object id. */ 104 104 void *pvObj; 105 /** Access restricted? */ 106 bool fRestrictAccess; 105 107 /** The length of the network name. */ 106 108 uint8_t cchName; … … 1201 1203 static int INTNETOpenNetwork(PINTNET pIntNet, PSUPDRVSESSION pSession, const char *pszNetwork, PINTNETNETWORK *ppNetwork) 1202 1204 { 1203 LogFlow(("INTNET CreateNetwork: pIntNet=%p pSession=%p pszNetwork=%p:{%s} ppNetwork=%p\n",1205 LogFlow(("INTNETOpenNetwork: pIntNet=%p pSession=%p pszNetwork=%p:{%s} ppNetwork=%p\n", 1204 1206 pIntNet, pSession, pszNetwork, pszNetwork, ppNetwork)); 1205 1207 … … 1234 1236 if (VBOX_SUCCESS(rc)) 1235 1237 { 1236 rc = SUPR0ObjVerifyAccess(pCur->pvObj, pSession, pCur->szName); 1238 if (pCur->fRestrictAccess) 1239 rc = SUPR0ObjVerifyAccess(pCur->pvObj, pSession, pCur->szName); 1237 1240 if (VBOX_SUCCESS(rc)) 1238 1241 *ppNetwork = pCur; … … 1269 1272 * @param ppNetwork Where to store the network. 1270 1273 */ 1271 static int INTNETCreateNetwork(PINTNET pIntNet, PSUPDRVSESSION pSession, const char *pszNetwork, PINTNETNETWORK *ppNetwork)1274 static int INTNETCreateNetwork(PINTNET pIntNet, PSUPDRVSESSION pSession, const char *pszNetwork, bool fRestrictAccess, PINTNETNETWORK *ppNetwork) 1272 1275 { 1273 1276 LogFlow(("INTNETCreateNetwork: pIntNet=%p pSession=%p pszNetwork=%p:{%s} ppNetwork=%p\n", … … 1308 1311 pNew->pIntNet = pIntNet; 1309 1312 pNew->cchName = cchName; 1313 pNew->fRestrictAccess = fRestrictAccess; 1310 1314 Assert(cchName && cchName < sizeof(pNew->szName)); /* caller's responsibility. */ 1311 1315 memcpy(pNew->szName, pszNetwork, cchName); /* '\0' by alloc. */ … … 1366 1370 * @param phIf Where to store the handle to the network interface. 1367 1371 */ 1368 INTNETR0DECL(int) INTNETR0Open(PINTNET pIntNet, PSUPDRVSESSION pSession, const char *pszNetwork, unsigned cbSend, unsigned cbRecv, PINTNETIFHANDLE phIf)1372 INTNETR0DECL(int) INTNETR0Open(PINTNET pIntNet, PSUPDRVSESSION pSession, const char *pszNetwork, unsigned cbSend, unsigned cbRecv, bool fRestrictAccess, PINTNETIFHANDLE phIf) 1369 1373 { 1370 1374 LogFlow(("INTNETR0Open: pIntNet=%p pSession=%p pszNetwork=%p:{%s} cbSend=%u cbRecv=%u phIf=%p\n", … … 1395 1399 rc = INTNETOpenNetwork(pIntNet, pSession, pszNetwork, &pNetwork); 1396 1400 if (rc == VERR_FILE_NOT_FOUND) 1397 rc = INTNETCreateNetwork(pIntNet, pSession, pszNetwork, &pNetwork);1401 rc = INTNETCreateNetwork(pIntNet, pSession, pszNetwork, fRestrictAccess, &pNetwork); 1398 1402 if (VBOX_SUCCESS(rc)) 1399 1403 { -
trunk/src/VBox/VMM/VMMR0/VMMR0.cpp
r1348 r1599 614 614 { 615 615 PINTNETOPENARGS pArgs = (PINTNETOPENARGS)pvArg; 616 return INTNETR0Open(g_pIntNet, pVM->pSession, &pArgs->szNetwork[0], pArgs->cbSend, pArgs->cbRecv, &pArgs->hIf);616 return INTNETR0Open(g_pIntNet, pVM->pSession, &pArgs->szNetwork[0], pArgs->cbSend, pArgs->cbRecv, pArgs->fRestrictAccess, &pArgs->hIf); 617 617 } 618 618
Note:
See TracChangeset
for help on using the changeset viewer.