VirtualBox

Changeset 107559 in vbox for trunk/src


Ignore:
Timestamp:
Jan 9, 2025 8:55:25 AM (7 weeks ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
166632
Message:

Main/src-server/NATNetworkImpl.cpp: Missing error checks + two todos, bugref:3409

File:
1 edited

Legend:

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

    r107440 r107559  
    958958         */
    959959
     960        /** @todo r=aeichner This comment doen't seem to reflect reality
     961         *                   When FindDHCPServerByNetworkName() returns E_INVALIDARG
     962         *                   a new DHCP server is created while the comment states that
     963         *                   the server should already exist... */
     964        /** @todo r=aeichner Returning an error should set an error message! */
    960965        /*
    961966         * Configuration and running DHCP server:
    962967         * 1. find server first createDHCPServer
    963          * 2. if return status is E_INVALARG => server already exists just find and start.
    964          * 3. if return status neither E_INVALRG nor S_OK => return E_FAIL
     968         * 2. if return status is E_INVALIDARG => server already exists just find and start.
     969         * 3. if return status neither E_INVALIDARG nor S_OK => return E_FAIL
    965970         * 4. if return status S_OK proceed to DHCP server configuration
    966971         * 5. call setConfiguration() and pass all required parameters
     
    972977        {
    973978            case E_INVALIDARG:
    974                 /* server haven't beeen found let create it then */
    975                 hrc = m->pVirtualBox->CreateDHCPServer(Bstr(m->s.strNetworkName).raw(),
    976                                                        m->dhcpServer.asOutParam());
    977                 if (FAILED(hrc))
    978                   return E_FAIL;
    979                 /* breakthrough */
    980 
    981979            {
    982980                LogFunc(("gateway: %s, dhcpserver:%s, dhcplowerip:%s, dhcpupperip:%s\n",
     
    986984                         m->IPv4DhcpServerUpperIp.c_str()));
    987985
     986                /* server haven't beeen found let create it then */
     987                hrc = m->pVirtualBox->CreateDHCPServer(Bstr(m->s.strNetworkName).raw(),
     988                                                       m->dhcpServer.asOutParam());
     989                if (FAILED(hrc))
     990                  return E_FAIL;
     991
    988992                hrc = m->dhcpServer->COMSETTER(Enabled)(true);
     993                if (FAILED(hrc))
     994                  return setError(hrc, tr("Failed to enable DHCP server for network '%s'"),
     995                                          m->s.strNetworkName.c_str());
    989996
    990997                hrc = m->dhcpServer->SetConfiguration(Bstr(m->IPv4DhcpServer).raw(),
     
    992999                                                      Bstr(m->IPv4DhcpServerLowerIp).raw(),
    9931000                                                      Bstr(m->IPv4DhcpServerUpperIp).raw());
     1001                if (FAILED(hrc))
     1002                  return setError(hrc, tr("Failed to set DHCP server configuration for network '%s'"),
     1003                                          m->s.strNetworkName.c_str());
     1004
    9941005                break;
    9951006            }
Note: See TracChangeset for help on using the changeset viewer.

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