VirtualBox

Changeset 79866 in vbox


Ignore:
Timestamp:
Jul 18, 2019 8:32:47 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
132264
Message:

Main/DHCPServer: Fixes to logging, individual vm/slot configs, and completed option forcing/suppression. bugref:9288

Location:
trunk/src/VBox/Main/src-server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/DHCPConfigImpl.cpp

    r79846 r79866  
    8484            char    *pszNext;
    8585            int vrc = RTStrToUInt8Ex(psz, &pszNext, 10, &bOpt);
    86             if (vrc == VINF_SUCCESS || vrc == VWRN_TRAILING_SPACES)
     86            if (   vrc == VINF_SUCCESS
     87                || vrc == VWRN_TRAILING_SPACES
     88                || vrc == VWRN_TRAILING_CHARS)
    8789            {
    8890                try
     
    525527        pElmConfig->setAttribute("secMaxLeaseTime", (uint32_t)m_secMaxLeaseTime);
    526528
     529    struct
     530    {
     531        const char                *pszElement;
     532        std::vector<DHCPOption_T> *pVec;
     533    } aVec2Elm[] =  { { "ForcedOption", &m_vecForcedOptions }, { "SuppressedOption", &m_vecSuppressedOptions }, };
     534    for (size_t i = 0; i < RT_ELEMENTS(aVec2Elm); i++)
     535        for (std::vector<DHCPOption_T>::const_iterator it = aVec2Elm[i].pVec->begin(); it != aVec2Elm[i].pVec->end(); ++it)
     536        {
     537            xml::ElementNode *pElmChild = pElmConfig->createChild(aVec2Elm[i].pszElement);
     538            pElmChild->setAttribute("name", (int)*it);
     539        }
     540
    527541    for (settings::DhcpOptionMap::const_iterator it = m_OptionMap.begin(); it != m_OptionMap.end(); ++it)
    528542    {
    529         xml::ElementNode *pOption = pElmConfig->createChild("Option");
    530         pOption->setAttribute("name", (int)it->first);
    531         pOption->setAttribute("encoding", it->second.enmEncoding);
    532         pOption->setAttribute("value", it->second.strValue);
     543        xml::ElementNode *pElmOption = pElmConfig->createChild("Option");
     544        pElmOption->setAttribute("name", (int)it->first);
     545        pElmOption->setAttribute("encoding", it->second.enmEncoding);
     546        pElmOption->setAttribute("value", it->second.strValue);
    533547    }
    534548}
  • trunk/src/VBox/Main/src-server/DHCPServerImpl.cpp

    r79845 r79866  
    257257        ComObjPtr<DHCPIndividualConfig> ptrIndiCfg;
    258258        com::Utf8Str                    strKey;
    259         if (!it->second.strVMName.isNotEmpty())
     259        if (it->second.strVMName.isEmpty())
    260260        {
    261261            RTMAC MACAddress;
     
    282282            if (SUCCEEDED(hrc))
    283283            {
     284                int vrc = strKey.printfNoThrow("%RTuuid/%u", idMachine.raw(), it->second.uSlot);
     285                AssertRCReturn(vrc, E_OUTOFMEMORY);
     286
    284287                hrc = ptrIndiCfg.createObject();
    285288                if (SUCCEEDED(hrc))
     
    851854                    {
    852855                        m->individualConfigs[strKey] = a_rPtrConfig;
    853                         return S_OK;
     856
     857                        /* Save settings. */
     858                        alock.release();
     859                        return i_doSaveSettings();
    854860                    }
    855861                    catch (std::bad_alloc &)
     
    11511157                vrc = m->dhcp.addArgPair("--config", m->strConfigFilename.c_str());
    11521158            if (RT_SUCCESS(vrc))
    1153                 vrc = m->dhcp.addArgPair("--log", m->networkName.c_str());
     1159                vrc = m->dhcp.addArgPair("--log", m->strLogFilename.c_str());
    11541160            /** @todo Add --log-flags, --log-group-settings, and --log-destinations with
    11551161             *        associated IDHCPServer attributes.  (Not doing it now because that'll
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette