Changeset 91872 in vbox
- Timestamp:
- Oct 20, 2021 9:07:44 AM (3 years ago)
- Location:
- trunk/src/VBox/Devices/Network
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DrvIntNet.cpp
r90791 r91872 1292 1292 uint32_t fFixedFlag, uint32_t *pfFlags) 1293 1293 { 1294 PCPDMDRVHLPR3 pHlp = pDrvIns->pHlpR3; 1295 1294 1296 char szValue[64]; 1295 int rc = CFGMR3QueryString(pDrvIns->pCfg, pszName, szValue, sizeof(szValue));1297 int rc = pHlp->pfnCFGMQueryString(pDrvIns->pCfg, pszName, szValue, sizeof(szValue)); 1296 1298 if (RT_FAILURE(rc)) 1297 1299 { … … 1354 1356 RT_NOREF(fFlags); 1355 1357 PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns); 1356 PDRVINTNET pThis = PDMINS_2_DATA(pDrvIns, PDRVINTNET); 1358 PDRVINTNET pThis = PDMINS_2_DATA(pDrvIns, PDRVINTNET); 1359 PCPDMDRVHLPR3 pHlp = pDrvIns->pHlpR3; 1357 1360 bool f; 1358 1361 … … 1441 1444 * The name of the internal network to connect to. 1442 1445 */ 1443 int rc = CFGMR3QueryString(pCfg, "Network", OpenReq.szNetwork, sizeof(OpenReq.szNetwork));1446 int rc = pHlp->pfnCFGMQueryString(pCfg, "Network", OpenReq.szNetwork, sizeof(OpenReq.szNetwork)); 1444 1447 if (RT_FAILURE(rc)) 1445 1448 return PDMDRV_SET_ERROR(pDrvIns, rc, … … 1451 1454 */ 1452 1455 uint32_t u32TrunkType; 1453 rc = CFGMR3QueryU32(pCfg, "TrunkType", &u32TrunkType);1456 rc = pHlp->pfnCFGMQueryU32(pCfg, "TrunkType", &u32TrunkType); 1454 1457 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 1455 1458 u32TrunkType = kIntNetTrunkType_None; … … 1462 1465 * The name of the trunk connection. 1463 1466 */ 1464 rc = CFGMR3QueryString(pCfg, "Trunk", OpenReq.szTrunk, sizeof(OpenReq.szTrunk));1467 rc = pHlp->pfnCFGMQueryString(pCfg, "Trunk", OpenReq.szTrunk, sizeof(OpenReq.szTrunk)); 1465 1468 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 1466 1469 OpenReq.szTrunk[0] = '\0'; … … 1476 1479 */ 1477 1480 bool fSharedMacOnWire; 1478 rc = CFGMR3QueryBoolDef(pCfg, "SharedMacOnWire", &fSharedMacOnWire, false);1481 rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "SharedMacOnWire", &fSharedMacOnWire, false); 1479 1482 if (RT_FAILURE(rc)) 1480 1483 return PDMDRV_SET_ERROR(pDrvIns, rc, … … 1488 1491 * @deprecated Use AccessPolicy instead. 1489 1492 */ 1490 rc = CFGMR3QueryBool(pCfg, "RestrictAccess", &f);1493 rc = pHlp->pfnCFGMQueryBool(pCfg, "RestrictAccess", &f); 1491 1494 if (RT_SUCCESS(rc)) 1492 1495 { … … 1507 1510 * restrictions from being lifted. If no further policy changes are 1508 1511 * desired, apply the relevant fixed flags. */ 1509 rc = CFGMR3QueryBoolDef(pCfg, "RequireExactPolicyMatch", &f, false);1512 rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "RequireExactPolicyMatch", &f, false); 1510 1513 if (RT_FAILURE(rc)) 1511 1514 return PDMDRV_SET_ERROR(pDrvIns, rc, … … 1519 1522 * and prevent them being lifted later on. 1520 1523 */ 1521 rc = CFGMR3QueryBoolDef(pCfg, "RequireAsRestrictivePolicy", &f, false);1524 rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "RequireAsRestrictivePolicy", &f, false); 1522 1525 if (RT_FAILURE(rc)) 1523 1526 return PDMDRV_SET_ERROR(pDrvIns, rc, … … 1627 1630 * The size of the receive buffer. 1628 1631 */ 1629 rc = CFGMR3QueryU32(pCfg, "ReceiveBufferSize", &OpenReq.cbRecv);1632 rc = pHlp->pfnCFGMQueryU32(pCfg, "ReceiveBufferSize", &OpenReq.cbRecv); 1630 1633 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 1631 1634 OpenReq.cbRecv = 318 * _1K ; … … 1642 1645 * side of it and the code will get very upset about it all. 1643 1646 */ 1644 rc = CFGMR3QueryU32(pCfg, "SendBufferSize", &OpenReq.cbSend);1647 rc = pHlp->pfnCFGMQueryU32(pCfg, "SendBufferSize", &OpenReq.cbSend); 1645 1648 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 1646 1649 OpenReq.cbSend = RT_ALIGN_Z(VBOX_MAX_GSO_SIZE * 3, _1K); … … 1658 1661 * a service such as LWIP/iSCSI it shouldn't suspend immediately like for a NIC. 1659 1662 */ 1660 rc = CFGMR3QueryBool(pCfg, "IsService", &pThis->fActivateEarlyDeactivateLate);1663 rc = pHlp->pfnCFGMQueryBool(pCfg, "IsService", &pThis->fActivateEarlyDeactivateLate); 1661 1664 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 1662 1665 pThis->fActivateEarlyDeactivateLate = false; … … 1670 1673 * network. */ 1671 1674 bool fIgnoreConnectFailure; 1672 rc = CFGMR3QueryBoolDef(pCfg, "IgnoreConnectFailure", &fIgnoreConnectFailure, false);1675 rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "IgnoreConnectFailure", &fIgnoreConnectFailure, false); 1673 1676 if (RT_FAILURE(rc)) 1674 1677 return PDMDRV_SET_ERROR(pDrvIns, rc, … … 1692 1695 } 1693 1696 #endif 1694 rc = CFGMR3QueryBoolDef(pCfg, "Workaround1", &fWorkaround1, fWorkaround1);1697 rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "Workaround1", &fWorkaround1, fWorkaround1); 1695 1698 if (RT_FAILURE(rc)) 1696 1699 return PDMDRV_SET_ERROR(pDrvIns, rc, -
trunk/src/VBox/Devices/Network/DrvNAT.cpp
r88553 r91872 78 78 #define VBOX_NAT_DELAY_HACK 79 79 80 #define GET_EXTRADATA(p this, node, name, rc, type, type_name, var) \80 #define GET_EXTRADATA(pdrvins, node, name, rc, type, type_name, var) \ 81 81 do { \ 82 (rc) = CFGMR3Query ## type((node), name, &(var)); \82 (rc) = (pdrvins)->pHlpR3->pfnCFGMQuery ## type((node), name, &(var)); \ 83 83 if (RT_FAILURE((rc)) && (rc) != VERR_CFGM_VALUE_NOT_FOUND) \ 84 return PDMDrvHlpVMSetError((p this)->pDrvIns, (rc), RT_SRC_POS, N_("NAT#%d: configuration query for \"" name "\" " #type_name " failed"), \85 (p this)->pDrvIns->iInstance); \84 return PDMDrvHlpVMSetError((pdrvins), (rc), RT_SRC_POS, N_("NAT#%d: configuration query for \"" name "\" " #type_name " failed"), \ 85 (pdrvins)->iInstance); \ 86 86 } while (0) 87 87 88 #define GET_ED_STRICT(p this, node, name, rc, type, type_name, var) \88 #define GET_ED_STRICT(pdrvins, node, name, rc, type, type_name, var) \ 89 89 do { \ 90 (rc) = CFGMR3Query ## type((node), name, &(var)); \90 (rc) = (pdrvins)->pHlpR3->pfnCFGMQuery ## type((node), name, &(var)); \ 91 91 if (RT_FAILURE((rc))) \ 92 return PDMDrvHlpVMSetError((p this)->pDrvIns, (rc), RT_SRC_POS, N_("NAT#%d: configuration query for \"" name "\" " #type_name " failed"), \93 (p this)->pDrvIns->iInstance); \92 return PDMDrvHlpVMSetError((pdrvins), (rc), RT_SRC_POS, N_("NAT#%d: configuration query for \"" name "\" " #type_name " failed"), \ 93 (pdrvins)->iInstance); \ 94 94 } while (0) 95 95 96 #define GET_EXTRADATA_N(p this, node, name, rc, type, type_name, var, var_size) \96 #define GET_EXTRADATA_N(pdrvins, node, name, rc, type, type_name, var, var_size) \ 97 97 do { \ 98 (rc) = CFGMR3Query ## type((node), name, &(var), var_size); \98 (rc) = (pdrvins)->pHlpR3->pfnCFGMQuery ## type((node), name, &(var), var_size); \ 99 99 if (RT_FAILURE((rc)) && (rc) != VERR_CFGM_VALUE_NOT_FOUND) \ 100 return PDMDrvHlpVMSetError((p this)->pDrvIns, (rc), RT_SRC_POS, N_("NAT#%d: configuration query for \"" name "\" " #type_name " failed"), \101 (p this)->pDrvIns->iInstance); \100 return PDMDrvHlpVMSetError((pdrvins), (rc), RT_SRC_POS, N_("NAT#%d: configuration query for \"" name "\" " #type_name " failed"), \ 101 (pdrvins)->iInstance); \ 102 102 } while (0) 103 103 104 #define GET_BOOL(rc, p this, node, name, var) \105 GET_EXTRADATA(p this, node, name, (rc), Bool, bolean, (var))106 #define GET_STRING(rc, p this, node, name, var, var_size) \107 GET_EXTRADATA_N(p this, node, name, (rc), String, string, (var), (var_size))108 #define GET_STRING_ALLOC(rc, p this, node, name, var) \109 GET_EXTRADATA(p this, node, name, (rc), StringAlloc, string, (var))110 #define GET_S32(rc, p this, node, name, var) \111 GET_EXTRADATA(p this, node, name, (rc), S32, int, (var))112 #define GET_S32_STRICT(rc, p this, node, name, var) \113 GET_ED_STRICT(p this, node, name, (rc), S32, int, (var))104 #define GET_BOOL(rc, pdrvins, node, name, var) \ 105 GET_EXTRADATA(pdrvins, node, name, (rc), Bool, bolean, (var)) 106 #define GET_STRING(rc, pdrvins, node, name, var, var_size) \ 107 GET_EXTRADATA_N(pdrvins, node, name, (rc), String, string, (var), (var_size)) 108 #define GET_STRING_ALLOC(rc, pdrvins, node, name, var) \ 109 GET_EXTRADATA(pdrvins, node, name, (rc), StringAlloc, string, (var)) 110 #define GET_S32(rc, pdrvins, node, name, var) \ 111 GET_EXTRADATA(pdrvins, node, name, (rc), S32, int, (var)) 112 #define GET_S32_STRICT(rc, pdrvins, node, name, var) \ 113 GET_ED_STRICT(pdrvins, node, name, (rc), S32, int, (var)) 114 114 115 115 … … 1320 1320 static int drvNATConstructDNSMappings(unsigned iInstance, PDRVNAT pThis, PCFGMNODE pMappingsCfg) 1321 1321 { 1322 PPDMDRVINS pDrvIns = pThis->pDrvIns; 1323 PCPDMDRVHLPR3 pHlp = pDrvIns->pHlpR3; 1324 1322 1325 RT_NOREF(iInstance); 1323 1326 int rc = VINF_SUCCESS; 1324 1327 LogFlowFunc(("ENTER: iInstance:%d\n", iInstance)); 1325 for (PCFGMNODE pNode = CFGMR3GetFirstChild(pMappingsCfg); pNode; pNode = CFGMR3GetNextChild(pNode))1326 { 1327 if (! CFGMR3AreValuesValid(pNode, "HostName\0HostNamePattern\0HostIP\0"))1328 for (PCFGMNODE pNode = pHlp->pfnCFGMGetFirstChild(pMappingsCfg); pNode; pNode = pHlp->pfnCFGMGetNextChild(pNode)) 1329 { 1330 if (!pHlp->pfnCFGMAreValuesValid(pNode, "HostName\0HostNamePattern\0HostIP\0")) 1328 1331 return PDMDRV_SET_ERROR(pThis->pDrvIns, VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES, 1329 1332 N_("Unknown configuration in dns mapping")); … … 1331 1334 bool fPattern = false; 1332 1335 RT_ZERO(szHostNameOrPattern); 1333 GET_STRING(rc, p This, pNode, "HostName", szHostNameOrPattern[0], sizeof(szHostNameOrPattern));1336 GET_STRING(rc, pDrvIns, pNode, "HostName", szHostNameOrPattern[0], sizeof(szHostNameOrPattern)); 1334 1337 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 1335 1338 { 1336 GET_STRING(rc, p This, pNode, "HostNamePattern", szHostNameOrPattern[0], sizeof(szHostNameOrPattern));1339 GET_STRING(rc, pDrvIns, pNode, "HostNamePattern", szHostNameOrPattern[0], sizeof(szHostNameOrPattern)); 1337 1340 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 1338 1341 { 1339 1342 char szNodeName[225]; 1340 1343 RT_ZERO(szNodeName); 1341 CFGMR3GetName(pNode, szNodeName, sizeof(szNodeName));1344 pHlp->pfnCFGMGetName(pNode, szNodeName, sizeof(szNodeName)); 1342 1345 LogRel(("NAT: Neither 'HostName' nor 'HostNamePattern' is specified for mapping %s\n", szNodeName)); 1343 1346 continue; … … 1347 1350 struct in_addr HostIP; 1348 1351 RT_ZERO(HostIP); 1349 GETIP_DEF(rc, p This, pNode, HostIP, INADDR_ANY);1352 GETIP_DEF(rc, pDrvIns, pNode, HostIP, INADDR_ANY); 1350 1353 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 1351 1354 { … … 1369 1372 static int drvNATConstructRedir(unsigned iInstance, PDRVNAT pThis, PCFGMNODE pCfg, PRTNETADDRIPV4 pNetwork) 1370 1373 { 1374 PPDMDRVINS pDrvIns = pThis->pDrvIns; 1375 PCPDMDRVHLPR3 pHlp = pDrvIns->pHlpR3; 1376 1371 1377 RT_NOREF(pNetwork); /** @todo figure why pNetwork isn't used */ 1372 1378 … … 1378 1384 * Enumerate redirections. 1379 1385 */ 1380 for (PCFGMNODE pNode = CFGMR3GetFirstChild(pPFTree); pNode; pNode = CFGMR3GetNextChild(pNode))1386 for (PCFGMNODE pNode = pHlp->pfnCFGMGetFirstChild(pPFTree); pNode; pNode = pHlp->pfnCFGMGetNextChild(pNode)) 1381 1387 { 1382 1388 /* 1383 1389 * Validate the port forwarding config. 1384 1390 */ 1385 if (! CFGMR3AreValuesValid(pNode, "Name\0Protocol\0UDP\0HostPort\0GuestPort\0GuestIP\0BindIP\0"))1386 return PDMDRV_SET_ERROR(p This->pDrvIns, VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES,1391 if (!pHlp->pfnCFGMAreValuesValid(pNode, "Name\0Protocol\0UDP\0HostPort\0GuestPort\0GuestIP\0BindIP\0")) 1392 return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES, 1387 1393 N_("Unknown configuration in port forwarding")); 1388 1394 … … 1391 1397 char szProtocol[32]; 1392 1398 int rc; 1393 GET_STRING(rc, p This, pNode, "Protocol", szProtocol[0], sizeof(szProtocol));1399 GET_STRING(rc, pDrvIns, pNode, "Protocol", szProtocol[0], sizeof(szProtocol)); 1394 1400 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 1395 1401 { 1396 1402 fUDP = false; 1397 GET_BOOL(rc, p This, pNode, "UDP", fUDP);1403 GET_BOOL(rc, pDrvIns, pNode, "UDP", fUDP); 1398 1404 } 1399 1405 else if (RT_SUCCESS(rc)) … … 1404 1410 fUDP = true; 1405 1411 else 1406 return PDMDrvHlpVMSetError(p This->pDrvIns, VERR_INVALID_PARAMETER, RT_SRC_POS,1412 return PDMDrvHlpVMSetError(pDrvIns, VERR_INVALID_PARAMETER, RT_SRC_POS, 1407 1413 N_("NAT#%d: Invalid configuration value for \"Protocol\": \"%s\""), 1408 1414 iInstance, szProtocol); 1409 1415 } 1410 1416 else 1411 return PDMDrvHlpVMSetError(p This->pDrvIns, rc, RT_SRC_POS,1417 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, 1412 1418 N_("NAT#%d: configuration query for \"Protocol\" failed"), 1413 1419 iInstance); 1414 1420 /* host port */ 1415 1421 int32_t iHostPort; 1416 GET_S32_STRICT(rc, p This, pNode, "HostPort", iHostPort);1422 GET_S32_STRICT(rc, pDrvIns, pNode, "HostPort", iHostPort); 1417 1423 1418 1424 /* guest port */ 1419 1425 int32_t iGuestPort; 1420 GET_S32_STRICT(rc, p This, pNode, "GuestPort", iGuestPort);1426 GET_S32_STRICT(rc, pDrvIns, pNode, "GuestPort", iGuestPort); 1421 1427 1422 1428 /* host address ("BindIP" name is rather unfortunate given "HostPort" to go with it) */ 1423 1429 struct in_addr BindIP; 1424 1430 RT_ZERO(BindIP); 1425 GETIP_DEF(rc, p This, pNode, BindIP, INADDR_ANY);1431 GETIP_DEF(rc, pDrvIns, pNode, BindIP, INADDR_ANY); 1426 1432 1427 1433 /* guest address */ 1428 1434 struct in_addr GuestIP; 1429 1435 RT_ZERO(GuestIP); 1430 GETIP_DEF(rc, p This, pNode, GuestIP, INADDR_ANY);1436 GETIP_DEF(rc, pDrvIns, pNode, GuestIP, INADDR_ANY); 1431 1437 1432 1438 /* … … 1524 1530 RT_NOREF(fFlags); 1525 1531 PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns); 1526 PDRVNAT pThis = PDMINS_2_DATA(pDrvIns, PDRVNAT); 1532 PDRVNAT pThis = PDMINS_2_DATA(pDrvIns, PDRVNAT); 1533 1527 1534 LogFlow(("drvNATConstruct:\n")); 1528 1535 … … 1574 1581 * Validate the config. 1575 1582 */ 1576 if (!CFGMR3AreValuesValid(pCfg, 1577 "PassDomain\0TFTPPrefix\0BootFile\0Network" 1578 "\0NextServer\0DNSProxy\0BindIP\0UseHostResolver\0" 1579 "SlirpMTU\0AliasMode\0" 1580 "SockRcv\0SockSnd\0TcpRcv\0TcpSnd\0" 1581 "ICMPCacheLimit\0" 1582 "SoMaxConnection\0" 1583 #ifdef VBOX_WITH_DNSMAPPING_IN_HOSTRESOLVER 1584 "HostResolverMappings\0" 1585 #endif 1586 )) 1587 return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES, 1588 N_("Unknown NAT configuration option, only supports PassDomain," 1589 " TFTPPrefix, BootFile and Network")); 1583 PDMDRV_VALIDATE_CONFIG_RETURN(pDrvIns, 1584 "PassDomain" 1585 "|TFTPPrefix" 1586 "|BootFile" 1587 "|Network" 1588 "|NextServer" 1589 "|DNSProxy" 1590 "|BindIP" 1591 "|UseHostResolver" 1592 "|SlirpMTU" 1593 "|AliasMode" 1594 "|SockRcv" 1595 "|SockSnd" 1596 "|TcpRcv" 1597 "|TcpSnd" 1598 "|ICMPCacheLimit" 1599 "|SoMaxConnection" 1600 //#ifdef VBOX_WITH_DNSMAPPING_IN_HOSTRESOLVER 1601 "|HostResolverMappings" 1602 //#endif 1603 , ""); 1590 1604 1591 1605 /* … … 1594 1608 int rc; 1595 1609 bool fPassDomain = true; 1596 GET_BOOL(rc, p This, pCfg, "PassDomain", fPassDomain);1597 1598 GET_STRING_ALLOC(rc, p This, pCfg, "TFTPPrefix", pThis->pszTFTPPrefix);1599 GET_STRING_ALLOC(rc, p This, pCfg, "BootFile", pThis->pszBootFile);1600 GET_STRING_ALLOC(rc, p This, pCfg, "NextServer", pThis->pszNextServer);1610 GET_BOOL(rc, pDrvIns, pCfg, "PassDomain", fPassDomain); 1611 1612 GET_STRING_ALLOC(rc, pDrvIns, pCfg, "TFTPPrefix", pThis->pszTFTPPrefix); 1613 GET_STRING_ALLOC(rc, pDrvIns, pCfg, "BootFile", pThis->pszBootFile); 1614 GET_STRING_ALLOC(rc, pDrvIns, pCfg, "NextServer", pThis->pszNextServer); 1601 1615 1602 1616 int fDNSProxy = 0; 1603 GET_S32(rc, p This, pCfg, "DNSProxy", fDNSProxy);1617 GET_S32(rc, pDrvIns, pCfg, "DNSProxy", fDNSProxy); 1604 1618 int fUseHostResolver = 0; 1605 GET_S32(rc, p This, pCfg, "UseHostResolver", fUseHostResolver);1619 GET_S32(rc, pDrvIns, pCfg, "UseHostResolver", fUseHostResolver); 1606 1620 int MTU = 1500; 1607 GET_S32(rc, p This, pCfg, "SlirpMTU", MTU);1621 GET_S32(rc, pDrvIns, pCfg, "SlirpMTU", MTU); 1608 1622 int i32AliasMode = 0; 1609 1623 int i32MainAliasMode = 0; 1610 GET_S32(rc, p This, pCfg, "AliasMode", i32MainAliasMode);1624 GET_S32(rc, pDrvIns, pCfg, "AliasMode", i32MainAliasMode); 1611 1625 int iIcmpCacheLimit = 100; 1612 GET_S32(rc, p This, pCfg, "ICMPCacheLimit", iIcmpCacheLimit);1626 GET_S32(rc, pDrvIns, pCfg, "ICMPCacheLimit", iIcmpCacheLimit); 1613 1627 1614 1628 i32AliasMode |= (i32MainAliasMode & 0x1 ? 0x1 : 0); … … 1616 1630 i32AliasMode |= (i32MainAliasMode & 0x4 ? 0x4 : 0); 1617 1631 int i32SoMaxConn = 10; 1618 GET_S32(rc, p This, pCfg, "SoMaxConnection", i32SoMaxConn);1632 GET_S32(rc, pDrvIns, pCfg, "SoMaxConnection", i32SoMaxConn); 1619 1633 /* 1620 1634 * Query the network port interface. … … 1633 1647 /* Generate a network address for this network card. */ 1634 1648 char szNetwork[32]; /* xxx.xxx.xxx.xxx/yy */ 1635 GET_STRING(rc, p This, pCfg, "Network", szNetwork[0], sizeof(szNetwork));1649 GET_STRING(rc, pDrvIns, pCfg, "Network", szNetwork[0], sizeof(szNetwork)); 1636 1650 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 1637 1651 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("NAT%d: Configuration error: missing network"), … … 1662 1676 1663 1677 char *pszBindIP = NULL; 1664 GET_STRING_ALLOC(rc, p This, pCfg, "BindIP", pszBindIP);1678 GET_STRING_ALLOC(rc, pDrvIns, pCfg, "BindIP", pszBindIP); 1665 1679 slirp_set_binding_address(pThis->pNATState, pszBindIP); 1666 1680 if (pszBindIP != NULL) -
trunk/src/VBox/Devices/Network/DrvNetShaper.cpp
r90346 r91872 415 415 static DECLCALLBACK(int) drvR3NetShaperConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags) 416 416 { 417 PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns); 417 418 PDRVNETSHAPER pThis = PDMINS_2_DATA(pDrvIns, PDRVNETSHAPER); 419 PCPDMDRVHLPR3 pHlp = pDrvIns->pHlpR3; 420 418 421 LogFlow(("drvNetShaperConstruct:\n")); 419 PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);420 422 421 423 /* … … 460 462 * Validate the config. 461 463 */ 462 if (!CFGMR3AreValuesValid(pCfg, "BwGroup\0")) 463 return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES; 464 PDMDRV_VALIDATE_CONFIG_RETURN(pDrvIns, "BwGroup", ""); 464 465 465 466 /* 466 467 * Find the bandwidth group we have to attach to. 467 468 */ 468 rc = CFGMR3QueryStringAlloc(pCfg, "BwGroup", &pThis->pszBwGroup);469 rc = pHlp->pfnCFGMQueryStringAlloc(pCfg, "BwGroup", &pThis->pszBwGroup); 469 470 if (RT_FAILURE(rc) && rc != VERR_CFGM_VALUE_NOT_FOUND) 470 471 { -
trunk/src/VBox/Devices/Network/DrvNetSniffer.cpp
r82968 r91872 374 374 static DECLCALLBACK(int) drvNetSnifferConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags) 375 375 { 376 PDRVNETSNIFFER pThis = PDMINS_2_DATA(pDrvIns, PDRVNETSNIFFER); 376 PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns); 377 PDRVNETSNIFFER pThis = PDMINS_2_DATA(pDrvIns, PDRVNETSNIFFER); 378 PCPDMDRVHLPR3 pHlp = pDrvIns->pHlpR3; 379 377 380 LogFlow(("drvNetSnifferConstruct:\n")); 378 PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);379 381 380 382 /* … … 415 417 * Validate the config. 416 418 */ 417 if (!CFGMR3AreValuesValid(pCfg, "File\0")) 418 return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES; 419 420 if (CFGMR3GetFirstChild(pCfg)) 419 PDMDRV_VALIDATE_CONFIG_RETURN(pDrvIns, "File", ""); 420 421 if (pHlp->pfnCFGMGetFirstChild(pCfg)) 421 422 LogRel(("NetSniffer: Found child config entries -- are you trying to redirect ports?\n")); 422 423 … … 424 425 * Get the filename. 425 426 */ 426 rc = CFGMR3QueryString(pCfg, "File", pThis->szFilename, sizeof(pThis->szFilename));427 rc = pHlp->pfnCFGMQueryString(pCfg, "File", pThis->szFilename, sizeof(pThis->szFilename)); 427 428 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 428 429 { -
trunk/src/VBox/Devices/Network/DrvTAP.cpp
r82968 r91872 854 854 RT_NOREF(fFlags); 855 855 PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns); 856 PDRVTAP pThis = PDMINS_2_DATA(pDrvIns, PDRVTAP); 856 PDRVTAP pThis = PDMINS_2_DATA(pDrvIns, PDRVTAP); 857 PCPDMDRVHLPR3 pHlp = pDrvIns->pHlpR3; 857 858 858 859 /* … … 897 898 * Validate the config. 898 899 */ 899 if (!CFGMR3AreValuesValid(pCfg, "Device\0InitProg\0TermProg\0FileHandle\0TAPSetupApplication\0TAPTerminateApplication\0MAC")) 900 return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES, ""); 900 PDMDRV_VALIDATE_CONFIG_RETURN(pDrvIns, "Device" 901 "|FileHandle" 902 "|TAPSetupApplication" 903 "|TAPTerminateApplication" 904 "|MAC", 905 ""); 901 906 902 907 /* … … 920 925 int rc; 921 926 #if defined(RT_OS_SOLARIS) /** @todo Other platforms' TAP code should be moved here from ConsoleImpl. */ 922 rc = CFGMR3QueryStringAlloc(pCfg, "TAPSetupApplication", &pThis->pszSetupApplication);927 rc = pHlp->pfnCFGMQueryStringAlloc(pCfg, "TAPSetupApplication", &pThis->pszSetupApplication); 923 928 if (RT_SUCCESS(rc)) 924 929 { … … 930 935 return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Configuration error: failed to query \"TAPTerminateApplication\"")); 931 936 932 rc = CFGMR3QueryStringAlloc(pCfg, "TAPTerminateApplication", &pThis->pszTerminateApplication);937 rc = pHlp->pfnCFGMQueryStringAlloc(pCfg, "TAPTerminateApplication", &pThis->pszTerminateApplication); 933 938 if (RT_SUCCESS(rc)) 934 939 { … … 940 945 return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Configuration error: failed to query \"TAPTerminateApplication\"")); 941 946 942 rc = CFGMR3QueryStringAlloc(pCfg, "Device", &pThis->pszDeviceName);947 rc = pHlp->pfnCFGMQueryStringAlloc(pCfg, "Device", &pThis->pszDeviceName); 943 948 if (RT_FAILURE(rc)) 944 949 pThis->fStatic = false; … … 963 968 964 969 uint64_t u64File; 965 rc = CFGMR3QueryU64(pCfg, "FileHandle", &u64File);970 rc = pHlp->pfnCFGMQueryU64(pCfg, "FileHandle", &u64File); 966 971 if (RT_FAILURE(rc)) 967 972 return PDMDRV_SET_ERROR(pDrvIns, rc, -
trunk/src/VBox/Devices/Network/DrvUDPTunnel.cpp
r82968 r91872 454 454 PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns); 455 455 PDRVUDPTUNNEL pThis = PDMINS_2_DATA(pDrvIns, PDRVUDPTUNNEL); 456 PCPDMDRVHLPR3 pHlp = pDrvIns->pHlpR3; 456 457 457 458 /* … … 488 489 * Validate the config. 489 490 */ 490 if (!CFGMR3AreValuesValid(pCfg, "sport\0dest\0dport")) 491 return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES, ""); 491 PDMDRV_VALIDATE_CONFIG_RETURN(pDrvIns, "sport" 492 "|dest" 493 "|dport", 494 ""); 492 495 493 496 /* … … 511 514 int rc; 512 515 char szVal[16]; 513 rc = CFGMR3QueryStringDef(pCfg, "sport", szVal, sizeof(szVal), "4444");516 rc = pHlp->pfnCFGMQueryStringDef(pCfg, "sport", szVal, sizeof(szVal), "4444"); 514 517 if (RT_FAILURE(rc)) 515 518 rc = PDMDRV_SET_ERROR(pDrvIns, rc, … … 522 525 pThis->uSrcPort = 4444; 523 526 524 rc = CFGMR3QueryStringDef(pCfg, "dport", szVal, sizeof(szVal), "4445");527 rc = pHlp->pfnCFGMQueryStringDef(pCfg, "dport", szVal, sizeof(szVal), "4445"); 525 528 if (RT_FAILURE(rc)) 526 529 rc = PDMDRV_SET_ERROR(pDrvIns, rc, … … 533 536 pThis->uDestPort = 4445; 534 537 535 rc = CFGMR3QueryStringAllocDef(pCfg, "dest", &pThis->pszDestIP, "127.0.0.1");538 rc = pHlp->pfnCFGMQueryStringAllocDef(pCfg, "dest", &pThis->pszDestIP, "127.0.0.1"); 536 539 if (RT_FAILURE(rc)) 537 540 rc = PDMDRV_SET_ERROR(pDrvIns, rc, -
trunk/src/VBox/Devices/Network/DrvVDE.cpp
r82968 r91872 540 540 RT_NOREF(fFlags); 541 541 PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns); 542 PDRVVDE pThis = PDMINS_2_DATA(pDrvIns, PDRVVDE); 542 PDRVVDE pThis = PDMINS_2_DATA(pDrvIns, PDRVVDE); 543 PCPDMDRVHLPR3 pHlp = pDrvIns->pHlpR3; 543 544 544 545 /* … … 576 577 * Validate the config. 577 578 */ 578 if (!CFGMR3AreValuesValid(pCfg, "network")) 579 return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES, ""); 579 PDMDRV_VALIDATE_CONFIG_RETURN(pDrvIns, "network", ""); 580 580 581 581 /* … … 599 599 int rc; 600 600 char szNetwork[RTPATH_MAX]; 601 rc = CFGMR3QueryString(pCfg, "network", szNetwork, sizeof(szNetwork));601 rc = pHlp->pfnCFGMQueryString(pCfg, "network", szNetwork, sizeof(szNetwork)); 602 602 if (RT_FAILURE(rc)) 603 603 *szNetwork=0;
Note:
See TracChangeset
for help on using the changeset viewer.