- Timestamp:
- Jul 29, 2009 9:39:25 AM (15 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/DHCPServerImpl.cpp
r20596 r21860 249 249 return S_OK; 250 250 251 m.dhcp.setOption(DHCPCFG_NETNAME, Utf8Str(aNetworkName) );251 m.dhcp.setOption(DHCPCFG_NETNAME, Utf8Str(aNetworkName), true); 252 252 Bstr tmp(aTrunkName); 253 253 if (!tmp.isEmpty()) 254 m.dhcp.setOption(DHCPCFG_TRUNKNAME, Utf8Str(tmp) );255 m.dhcp.setOption(DHCPCFG_TRUNKTYPE, Utf8Str(aTrunkType) );254 m.dhcp.setOption(DHCPCFG_TRUNKNAME, Utf8Str(tmp), true); 255 m.dhcp.setOption(DHCPCFG_TRUNKTYPE, Utf8Str(aTrunkType), true); 256 256 //temporary hack for testing 257 257 // DHCPCFG_NAME … … 261 261 RTStrPrintf (strMAC, sizeof(strMAC), "080027%02X%02X%02X", 262 262 guid.ptr()->au8[0], guid.ptr()->au8[1], guid.ptr()->au8[2]); 263 m.dhcp.setOption(DHCPCFG_MACADDRESS, strMAC );264 m.dhcp.setOption(DHCPCFG_IPADDRESS, Utf8Str(m.IPAddress) );263 m.dhcp.setOption(DHCPCFG_MACADDRESS, strMAC, true); 264 m.dhcp.setOption(DHCPCFG_IPADDRESS, Utf8Str(m.IPAddress), true); 265 265 // DHCPCFG_LEASEDB, 266 266 // DHCPCFG_VERBOSE, 267 267 // DHCPCFG_GATEWAY, 268 m.dhcp.setOption(DHCPCFG_LOWERIP, Utf8Str(m.lowerIP) );269 m.dhcp.setOption(DHCPCFG_UPPERIP, Utf8Str(m.upperIP) );270 m.dhcp.setOption(DHCPCFG_NETMASK, Utf8Str(m.networkMask) );268 m.dhcp.setOption(DHCPCFG_LOWERIP, Utf8Str(m.lowerIP), true); 269 m.dhcp.setOption(DHCPCFG_UPPERIP, Utf8Str(m.upperIP), true); 270 m.dhcp.setOption(DHCPCFG_NETMASK, Utf8Str(m.networkMask), true); 271 271 272 272 // DHCPCFG_HELP, 273 273 // DHCPCFG_VERSION, 274 274 // DHCPCFG_NOTOPT_MAXVAL 275 m.dhcp.setOption(DHCPCFG_BEGINCONFIG, "" );275 m.dhcp.setOption(DHCPCFG_BEGINCONFIG, "", true); 276 276 277 277 return RT_FAILURE(m.dhcp.start()) ? E_FAIL : S_OK; -
trunk/src/VBox/Main/DHCPServerRunner.cpp
r21404 r21860 64 64 } 65 65 66 DHCPServerRunner::DHCPServerRunner() 67 { 68 mProcess = NIL_RTPROCESS; 69 for (unsigned i = 0; i < DHCPCFG_NOTOPT_MAXVAL; i++) 70 { 71 mOptionEnabled[i] = false; 72 } 73 } 74 66 75 void DHCPServerRunner::detachFromServer() 67 76 { … … 97 106 for (unsigned i = 0; i < DHCPCFG_NOTOPT_MAXVAL; i++) 98 107 { 99 if (mOption s[i].length())108 if (mOptionEnabled[i]) 100 109 { 101 110 const ARGDEF * pArgDef = getArgDef((DHCPCFG)i); 102 111 args[index++] = pArgDef->Name; // e.g. "--network" 103 args[index++] = mOptions[i].raw(); // value 112 113 /* value can be null for e.g. --begin-config has no value 114 * and thus check the mOptions string length here 115 */ 116 if (mOptions[i].length()) 117 args[index++] = mOptions[i].raw(); // value 104 118 } 105 119 } -
trunk/src/VBox/Main/include/DHCPServerRunner.h
r21387 r21860 53 53 { 54 54 public: 55 DHCPServerRunner() : mProcess (NIL_RTPROCESS) {}55 DHCPServerRunner(); 56 56 ~DHCPServerRunner() { stop(); /* don't leave abandoned servers */} 57 57 58 int setOption(DHCPCFG opt, const char *val )58 int setOption(DHCPCFG opt, const char *val, bool enabled) 59 59 { 60 60 if(opt == 0 || opt >= DHCPCFG_NOTOPT_MAXVAL) … … 75 75 mOptions[opt] = val; 76 76 } 77 mOptionEnabled[opt] = enabled; 77 78 return VINF_SUCCESS; 78 79 } … … 85 86 private: 86 87 com::Utf8Str mOptions[DHCPCFG_NOTOPT_MAXVAL]; 88 bool mOptionEnabled[DHCPCFG_NOTOPT_MAXVAL]; 87 89 RTPROCESS mProcess; 88 90 };
Note:
See TracChangeset
for help on using the changeset viewer.