Changeset 18208 in vbox for trunk/src/VBox/Devices/Network
- Timestamp:
- Mar 24, 2009 5:01:32 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DrvIntNet.cpp
r18099 r18208 44 44 # include "win/DrvIntNet-win.h" 45 45 #endif 46 47 #include "DHCPServerRunner.h"48 46 49 47 /******************************************************************************* … … 1073 1071 Log(("IntNet%d: hIf=%RX32 '%s'\n", pDrvIns->iInstance, pThis->hIf, pThis->szNetwork)); 1074 1072 1075 if(rc != VINF_ALREADY_INITIALIZED)1076 {1077 /* new network gets created, check if we need to launch a DHCP server for it */1078 char ip[16], mask[16], lowerIp[16], upperIp[16], mac[13];1079 rc = CFGMR3QueryString(pCfgHandle, "DhcpIPAddress", ip, sizeof(ip));1080 if (RT_SUCCESS(rc))1081 {1082 /* this means we have DHCP server enabled */1083 rc = CFGMR3QueryString(pCfgHandle, "DhcpNetworkMask", mask, sizeof(mask));1084 if (RT_FAILURE(rc))1085 return PDMDRV_SET_ERROR(pDrvIns, rc,1086 N_("Configuration error: Failed to get the \"DhcpNetworkMask\" value"));1087 1088 rc = CFGMR3QueryString(pCfgHandle, "DhcpLowerIP", lowerIp, sizeof(lowerIp));1089 if (RT_FAILURE(rc))1090 return PDMDRV_SET_ERROR(pDrvIns, rc,1091 N_("Configuration error: Failed to get the \"DhcpLowerIP\" value"));1092 1093 rc = CFGMR3QueryString(pCfgHandle, "DhcpUpperIP", upperIp, sizeof(upperIp));1094 if (RT_FAILURE(rc))1095 return PDMDRV_SET_ERROR(pDrvIns, rc,1096 N_("Configuration error: Failed to get the \"DhcpUpperIP\" value"));1097 1098 rc = CFGMR3QueryString(pCfgHandle, "DhcpMacAddress", mac, sizeof(mac));1099 if (RT_FAILURE(rc))1100 return PDMDRV_SET_ERROR(pDrvIns, rc,1101 N_("Configuration error: Failed to get the \"DhcpMacAddress\" value"));1102 1103 1104 DHCPServerRunner dhcp;1105 dhcp.setOption(DHCPCFG_NETNAME, OpenReq.szNetwork);1106 if(OpenReq.enmTrunkType == kIntNetTrunkType_NetFlt1107 || OpenReq.enmTrunkType == kIntNetTrunkType_NetAdp)1108 dhcp.setOption(DHCPCFG_TRUNKNAME, OpenReq.szTrunk);1109 1110 switch(OpenReq.enmTrunkType)1111 {1112 case kIntNetTrunkType_WhateverNone:1113 case kIntNetTrunkType_None:1114 dhcp.setOption(DHCPCFG_TRUNKTYPE, TRUNKTYPE_WHATEVER);1115 break;1116 case kIntNetTrunkType_NetFlt:1117 dhcp.setOption(DHCPCFG_TRUNKTYPE, TRUNKTYPE_NETFLT);1118 break;1119 case kIntNetTrunkType_NetAdp:1120 dhcp.setOption(DHCPCFG_TRUNKTYPE, TRUNKTYPE_NETADP);1121 break;1122 case kIntNetTrunkType_SrvNat:1123 dhcp.setOption(DHCPCFG_TRUNKTYPE, TRUNKTYPE_SRVNAT);1124 break;1125 default:1126 AssertFailed();1127 break;1128 }1129 //temporary hack for testing1130 // DHCPCFG_NAME1131 dhcp.setOption(DHCPCFG_MACADDRESS, mac);1132 dhcp.setOption(DHCPCFG_IPADDRESS, ip);1133 // DHCPCFG_LEASEDB,1134 // DHCPCFG_VERBOSE,1135 // DHCPCFG_GATEWAY,1136 dhcp.setOption(DHCPCFG_LOWERIP, lowerIp);1137 dhcp.setOption(DHCPCFG_UPPERIP, upperIp);1138 dhcp.setOption(DHCPCFG_NETMASK, mask);1139 1140 // DHCPCFG_HELP,1141 // DHCPCFG_VERSION,1142 // DHCPCFG_NOTOPT_MAXVAL1143 dhcp.setOption(DHCPCFG_BEGINCONFIG, "");1144 dhcp.start();1145 1146 dhcp.detachFromServer(); /* need to do this to avoid server shutdown on runner destruction */1147 }1148 }1149 1150 1073 /* 1151 1074 * Get default buffer.
Note:
See TracChangeset
for help on using the changeset viewer.