Changeset 79613 in vbox for trunk/src/VBox/NetworkServices
- Timestamp:
- Jul 8, 2019 11:50:48 PM (6 years ago)
- Location:
- trunk/src/VBox/NetworkServices/Dhcpd
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/NetworkServices/Dhcpd/Config.cpp
r79568 r79613 169 169 { 170 170 m_strBaseName = m_strNetwork; 171 172 /** @todo make IPRT function for this. */ 173 char ch; 174 #if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2) 175 static const char s_szIllegals[] = "/\\\"*:<>?|\t\v\n\r\f\a\b"; /** @todo all control chars... */ 176 for (char *psz = m_strBaseName.mutableRaw(); (ch = *psz) != '\0'; ++psz) 177 if (strchr(s_szIllegals, ch)) 178 *psz = '_'; 179 #else 180 for (char *psz = m_strBaseName.mutableRaw(); (ch = *psz) != '\0'; ++psz) 181 if (RTPATH_IS_SEP(ch)) 182 *psz = '_'; 183 #endif 184 m_strBaseName.jolt(); /* Not really necessary, but it's protocol. */ 171 RTPathPurgeFilename(m_strBaseName.mutableRaw(), RTPATH_STR_F_STYLE_HOST); 172 m_strBaseName.jolt(); 185 173 } 186 174 else … … 260 248 RTUUID Uuid; 261 249 int rc = RTUuidCreate(&Uuid); 262 AssertR eturn(rc, rc);250 AssertRCReturn(rc, rc); 263 251 264 252 m_MacAddress.au8[0] = 0x08; … … 747 735 m_strTrunk = ""; 748 736 737 m_strLeaseFilename = pElmServer->findAttributeValue("leaseFilename"); /* optional */ 738 749 739 i_getIPv4AddrAttribute(pElmServer, "IPAddress", &m_IPv4Address); 750 740 i_getIPv4AddrAttribute(pElmServer, "networkMask", &m_IPv4Netmask); -
trunk/src/VBox/NetworkServices/Dhcpd/Config.h
r79563 r79613 46 46 RTCString m_strNetwork; /**< The name of the internal network the DHCP server is connected to. */ 47 47 RTCString m_strBaseName; /**< m_strNetwork sanitized to be usable in a path component. */ 48 RTCString m_strLeaseFilename; /**< The lease filename if one given. Dhcpd will pick a default if empty. */ 48 49 49 50 RTCString m_strTrunk; /**< The trunk name of the internal network. */ … … 91 92 92 93 const RTCString &getNetwork() const RT_NOEXCEPT { return m_strNetwork; } 94 const RTCString &getBaseName() const RT_NOEXCEPT { return m_strBaseName; } 95 const RTCString &getLeaseFilename() const RT_NOEXCEPT { return m_strLeaseFilename; } 93 96 94 const RTCString &getBaseName() const RT_NOEXCEPT { return m_strBaseName; }95 97 const RTCString &getTrunk() const RT_NOEXCEPT { return m_strTrunk; } 96 98 INTNETTRUNKTYPE getTrunkType() const RT_NOEXCEPT { return m_enmTrunkType; } -
trunk/src/VBox/NetworkServices/Dhcpd/DHCPD.cpp
r79568 r79613 45 45 AssertReturn(!m_pConfig, VERR_INVALID_STATE); 46 46 47 /** @todo r=bird: This must be configurable so main can read the database and48 * fish assignments out of it. (That's the most efficient and accurate way of49 * figuring out the IP address of a VM.) */50 51 47 /* leases filename */ 52 int rc = m_strLeasesFilename.assignNoThrow(pConfig->getHome()); 53 if (RT_SUCCESS(rc)) 54 rc = RTPathAppendCxx(m_strLeasesFilename, pConfig->getBaseName()); 55 if (RT_SUCCESS(rc)) 56 rc = m_strLeasesFilename.appendNoThrow("-Dhcpd.leases"); 48 int rc; 49 if (pConfig->getLeaseFilename().isEmpty()) 50 rc = m_strLeasesFilename.assignNoThrow(pConfig->getLeaseFilename()); 51 else 52 { 53 rc = m_strLeasesFilename.assignNoThrow(pConfig->getHome()); 54 if (RT_SUCCESS(rc)) 55 rc = RTPathAppendCxx(m_strLeasesFilename, pConfig->getBaseName()); 56 if (RT_SUCCESS(rc)) 57 rc = m_strLeasesFilename.appendNoThrow("-Dhcpd.leases"); 58 } 57 59 if (RT_SUCCESS(rc)) 58 60 { … … 322 324 if (req.ciaddr().u != 0 && reqAddr.present() && reqAddr.value().u != req.ciaddr().u) 323 325 { 324 std::unique_ptr<DhcpServerMessage> nak ( 325 i_createMessage(RTNET_DHCP_MT_NAC, req) 326 ); 326 std::unique_ptr<DhcpServerMessage> nak(i_createMessage(RTNET_DHCP_MT_NAC, req)); 327 327 nak->addOption(OptMessage("Requested address does not match ciaddr")); 328 328 return nak.release(); … … 349 349 ack->addOptions(m_pConfig->getOptions(replyOptions, optlist, req.clientId())); 350 350 351 /** @todo r=bird: Sec 9.9 in rfc-2132 indicates the server only sends this in NACKs. Test code? */ 351 352 ack->addOption(OptMessage("Ok, ok, here it is")); 352 353
Note:
See TracChangeset
for help on using the changeset viewer.