Changeset 17961 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Mar 16, 2009 5:47:47 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DrvIntNet.cpp
r17952 r17961 781 781 "IgnoreTrunkHostPromisc\0" 782 782 "QuietlyIgnoreTrunkHostPromisc\0" 783 "IsService\0")) 783 "IsService\0" 784 "DhcpIPAddress\0" 785 "DhcpNetworkMask\0" 786 "DhcpLowerIP\0" 787 "DhcpUpperIP\0" 788 "DhcpMacAddress\0")) 784 789 return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES; 785 790 … … 1067 1072 pThis->hIf = OpenReq.hIf; 1068 1073 Log(("IntNet%d: hIf=%RX32 '%s'\n", pDrvIns->iInstance, pThis->hIf, pThis->szNetwork)); 1069 #if 0 1070 DhcpServerRunner dhcp; 1071 dhcp.setOption(DHCPCFG_NETNAME, OpenReq.szNetwork); 1072 dhcp.setOption(DHCPCFG_TRUNKNAME, OpenReq.szTrunk); 1073 switch(OpenReq.enmTrunkType) 1074 { 1075 case kIntNetTrunkType_WhateverNone: 1076 dhcp.setOption(DHCPCFG_TRUNKTYPE, TRUNKTYPE_WHATEVER); 1077 break; 1078 case kIntNetTrunkType_NetFlt: 1079 dhcp.setOption(DHCPCFG_TRUNKTYPE, TRUNKTYPE_NETFLT); 1080 break; 1081 case kIntNetTrunkType_NetAdp: 1082 dhcp.setOption(DHCPCFG_TRUNKTYPE, TRUNKTYPE_NETADP); 1083 break; 1084 case kIntNetTrunkType_SrvNat: 1085 dhcp.setOption(DHCPCFG_TRUNKTYPE, TRUNKTYPE_SRVNAT); 1086 break; 1087 } 1088 //temporary hack for testing 1089 // DHCPCFG_NAME 1090 dhcp.setOption(DHCPCFG_MACADDRESS, "080027A03128"); 1091 dhcp.setOption(DHCPCFG_IPADDRESS, "192.168.55.1"); 1092 // DHCPCFG_LEASEDB, 1093 // DHCPCFG_VERBOSE, 1094 // DHCPCFG_GATEWAY, 1095 dhcp.setOption(DHCPCFG_LOWERIP, "192.168.55.10"); 1096 dhcp.setOption(DHCPCFG_UPPERIP, "192.168.55.100"); 1097 dhcp.setOption(DHCPCFG_NETMASK, "255.255.255.0"); 1098 1099 // DHCPCFG_HELP, 1100 // DHCPCFG_VERSION, 1101 // DHCPCFG_NOTOPT_MAXVAL 1102 dhcp.setOption(DHCPCFG_BEGINCONFIG, ""); 1103 dhcp.start(); 1104 1105 dhcp.detachFromServer(); /* need to do this to avoid server shutdown on runner destruction */ 1106 #endif 1074 1075 char ip[16], mask[16], lowerIp[16], upperIp[16], mac[13]; 1076 rc = CFGMR3QueryString(pCfgHandle, "DhcpIPAddress", ip, sizeof(ip)); 1077 if (RT_SUCCESS(rc)) 1078 { 1079 /* this means we have DHCP server enabled */ 1080 rc = CFGMR3QueryString(pCfgHandle, "DhcpNetworkMask", mask, sizeof(mask)); 1081 if (RT_FAILURE(rc)) 1082 return PDMDRV_SET_ERROR(pDrvIns, rc, 1083 N_("Configuration error: Failed to get the \"DhcpNetworkMask\" value")); 1084 1085 rc = CFGMR3QueryString(pCfgHandle, "DhcpLowerIP", lowerIp, sizeof(lowerIp)); 1086 if (RT_FAILURE(rc)) 1087 return PDMDRV_SET_ERROR(pDrvIns, rc, 1088 N_("Configuration error: Failed to get the \"DhcpLowerIP\" value")); 1089 1090 rc = CFGMR3QueryString(pCfgHandle, "DhcpUpperIP", upperIp, sizeof(upperIp)); 1091 if (RT_FAILURE(rc)) 1092 return PDMDRV_SET_ERROR(pDrvIns, rc, 1093 N_("Configuration error: Failed to get the \"DhcpUpperIP\" value")); 1094 1095 rc = CFGMR3QueryString(pCfgHandle, "DhcpMacAddress", mac, sizeof(mac)); 1096 if (RT_FAILURE(rc)) 1097 return PDMDRV_SET_ERROR(pDrvIns, rc, 1098 N_("Configuration error: Failed to get the \"DhcpMacAddress\" value")); 1099 1100 1101 DhcpServerRunner dhcp; 1102 dhcp.setOption(DHCPCFG_NETNAME, OpenReq.szNetwork); 1103 dhcp.setOption(DHCPCFG_TRUNKNAME, OpenReq.szTrunk); 1104 switch(OpenReq.enmTrunkType) 1105 { 1106 case kIntNetTrunkType_WhateverNone: 1107 dhcp.setOption(DHCPCFG_TRUNKTYPE, TRUNKTYPE_WHATEVER); 1108 break; 1109 case kIntNetTrunkType_NetFlt: 1110 dhcp.setOption(DHCPCFG_TRUNKTYPE, TRUNKTYPE_NETFLT); 1111 break; 1112 case kIntNetTrunkType_NetAdp: 1113 dhcp.setOption(DHCPCFG_TRUNKTYPE, TRUNKTYPE_NETADP); 1114 break; 1115 case kIntNetTrunkType_SrvNat: 1116 dhcp.setOption(DHCPCFG_TRUNKTYPE, TRUNKTYPE_SRVNAT); 1117 break; 1118 } 1119 //temporary hack for testing 1120 // DHCPCFG_NAME 1121 dhcp.setOption(DHCPCFG_MACADDRESS, mac); 1122 dhcp.setOption(DHCPCFG_IPADDRESS, ip); 1123 // DHCPCFG_LEASEDB, 1124 // DHCPCFG_VERBOSE, 1125 // DHCPCFG_GATEWAY, 1126 dhcp.setOption(DHCPCFG_LOWERIP, lowerIp); 1127 dhcp.setOption(DHCPCFG_UPPERIP, upperIp); 1128 dhcp.setOption(DHCPCFG_NETMASK, mask); 1129 1130 // DHCPCFG_HELP, 1131 // DHCPCFG_VERSION, 1132 // DHCPCFG_NOTOPT_MAXVAL 1133 dhcp.setOption(DHCPCFG_BEGINCONFIG, ""); 1134 dhcp.start(); 1135 1136 dhcp.detachFromServer(); /* need to do this to avoid server shutdown on runner destruction */ 1137 } 1138 1107 1139 /* 1108 1140 * Get default buffer.
Note:
See TracChangeset
for help on using the changeset viewer.