VirtualBox

Changeset 79509 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jul 3, 2019 3:41:17 PM (6 years ago)
Author:
vboxsync
Message:

Dhcpd: Ditched std:vector<char> + catch with wrong slash non-sense in VBoxNetDhcpd::vmmInit(). Misc cleanups.

Location:
trunk/src/VBox/NetworkServices/Dhcpd
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/NetworkServices/Dhcpd/Config.cpp

    r76553 r79509  
    7474int Config::homeInit()
    7575{
    76     int rc;
    77 
    7876    /* pathname of ~/.VirtualBox or equivalent */
    7977    char szHome[RTPATH_MAX];
    80     rc = com::GetVBoxUserHomeDirectory(szHome, sizeof(szHome), false);
     78    int rc = com::GetVBoxUserHomeDirectory(szHome, sizeof(szHome), false);
    8179    if (RT_FAILURE(rc))
    8280    {
     
    596594    parseServer(root);
    597595
    598     /** @todo r=bird: Visual C++ 2010 does not grok this use of 'auto'. */
    599596    // XXX: debug
    600597    for (optmap_t::const_iterator it = m_GlobalOptions.begin(); it != m_GlobalOptions.end(); ++it) {
     
    721718
    722719
    723 /*
     720/**
    724721 * VM Config entries are generated automatically from VirtualBox.xml
    725722 * with the MAC fetched from the VM config.  The client id is nowhere
     
    787784
    788785
    789 /*
     786/**
    790787 * Parse <Option/> element and add the option to the specified optmap.
    791788 */
     
    845842
    846843
    847 /*
     844/**
    848845 * Set m_strBaseName to sanitized version of m_strNetwork that can be
    849846 * used in a path component.
     
    861858        return;
    862859
    863     for (char *p = szBaseName; *p != '\0'; ++p)
    864     {
    865         if (RTPATH_IS_SEP(*p))
    866         {
     860    char ch;
     861#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
     862    static const char s_szIllegals[] = "/\\\"*:<>?|\t\v\n\r\f\a\b"; /** @todo all control chars... */
     863    for (char *p = szBaseName; (ch = *p) != '\0'; ++p)
     864        if (strchr(s_szIllegals, ch))
    867865            *p = '_';
    868         }
    869     }
     866#else
     867    for (char *p = szBaseName; (ch = *p) != '\0'; ++p)
     868        if (RTPATH_IS_SEP(ch))
     869            *p = '_';
     870#endif
    870871
    871872    m_strBaseName.assign(szBaseName);
  • trunk/src/VBox/NetworkServices/Dhcpd/Db.cpp

    r76553 r79509  
    473473            return addrBinding;
    474474        }
    475         else
    476         {
    477             LogDHCP(("> .... cannot reuse %s binding for this address\n",
    478                      addrBinding->stateName()));
    479         }
     475        LogDHCP(("> .... cannot reuse %s binding for this address\n",
     476                 addrBinding->stateName()));
    480477    }
    481478
     
    544541    Assert(b->id() == id);
    545542
    546     /*
     543    /** @todo
    547544     * XXX: handle requests for specific lease time!
    548545     * XXX: old lease might not have expired yet?
  • trunk/src/VBox/NetworkServices/Dhcpd/Makefile.kmk

    r76553 r79509  
    5050 VBoxNetDhcpd_INCS += . $(addprefix ../../Devices/Network/lwip-new/,$(LWIP_INCS))
    5151
    52  VBoxNetDhcpd_DEFS    = KBUILD_TYPE=\"$(KBUILD_TYPE)\"
     52 VBoxNetDhcpd_DEFS       = KBUILD_TYPE=\"$(KBUILD_TYPE)\"
    5353 ifneq ($(KBUILD_TARGET),win)
    5454  VBoxNetDhcpd_DEFS     += VBOX_WITH_XPCOM
     
    5959  endif
    6060 endif
    61  VBoxNetDhcpd_SOURCES = ../../Main/glue/VBoxLogRelCreate.cpp \
    62                         ../../Main/glue/GetVBoxUserHomeDirectory.cpp \
    63                         ClientId.cpp \
    64                         Config.cpp \
    65                         DHCPD.cpp \
    66                         Db.cpp \
    67                         DhcpMessage.cpp \
    68                         DhcpOptions.cpp \
    69                         IPv4Pool.cpp \
    70                         TimeStamp.cpp \
    71                         VBoxNetDhcpd.cpp \
    72                         $(addprefix ../../Devices/Network/lwip-new/,$(LWIP_SOURCES))
     61 VBoxNetDhcpd_SOURCES = \
     62        ClientId.cpp \
     63        Config.cpp \
     64        DHCPD.cpp \
     65        Db.cpp \
     66        DhcpMessage.cpp \
     67        DhcpOptions.cpp \
     68        IPv4Pool.cpp \
     69        TimeStamp.cpp \
     70        VBoxNetDhcpd.cpp \
     71        ../../Main/glue/VBoxLogRelCreate.cpp \
     72        ../../Main/glue/GetVBoxUserHomeDirectory.cpp \
     73        $(addprefix ../../Devices/Network/lwip-new/,$(LWIP_SOURCES))
    7374
    7475 VBoxNetDhcpd_LIBS = $(LIB_RUNTIME)
    75 
    7676 VBoxNetDhcpd_LIBS.solaris += socket nsl
    7777 VBoxNetDhcpd_LDFLAGS.win = /SUBSYSTEM:windows
  • trunk/src/VBox/NetworkServices/Dhcpd/VBoxNetDhcpd.cpp

    r76553 r79509  
    244244int VBoxNetDhcpd::vmmInit()
    245245{
    246     int rc;
    247     try {
    248         std::vector<char> vExecDir(RTPATH_MAX);
    249         rc = RTPathExecDir(&vExecDir.front(), vExecDir.size());
    250         if (RT_FAILURE(rc))
    251             return rc;
    252         std::string strPath(&vExecDir.front());
    253         strPath.append("/VMMR0.r0");
    254 
    255         rc = SUPR3LoadVMM(strPath.c_str());
    256         if (RT_FAILURE(rc))
    257             return rc;
    258 
    259         rc = VINF_SUCCESS;
    260     }
    261     catch (...)
    262     {
    263         rc = VERR_GENERAL_FAILURE;
    264     }
    265 
     246    char szPathVMMR0[RTPATH_MAX];
     247    int rc = RTPathExecDir(szPathVMMR0, sizeof(szPathVMMR0));
     248    if (RT_SUCCESS(rc))
     249        rc = RTPathAppend(szPathVMMR0, sizeof(szPathVMMR0), "VMMR0.r0");
     250    if (RT_SUCCESS(rc))
     251        rc = SUPR3LoadVMM(szPathVMMR0);
    266252    return rc;
    267253}
     
    316302
    317303    OpenReq.fFlags = 0;
    318     OpenReq.cbSend = 128 * _1K;
    319     OpenReq.cbRecv = 256 * _1K;
     304    OpenReq.cbSend = _128K;
     305    OpenReq.cbRecv = _256K;
    320306
    321307    OpenReq.hIf = INTNET_HANDLE_INVALID;
     
    471457
    472458
    473 /*
     459/**
    474460 * Got a frame from the internal network, feed it to the lwIP stack.
    475461 */
     
    495481     */
    496482    struct pbuf *q = p;
    497     uint8_t *pu8Chunk = (uint8_t *)pvFrame;
     483    uint8_t *pbChunk = (uint8_t *)pvFrame;
    498484    do {
    499485        uint8_t *payload = (uint8_t *)q->payload;
     
    507493        }
    508494#endif
    509         memcpy(payload, pu8Chunk, len);
    510         pu8Chunk += len;
     495        memcpy(payload, pbChunk, len);
     496        pbChunk += len;
    511497        q = q->next;
    512498    } while (RT_UNLIKELY(q != NULL));
     
    517503
    518504
    519 /*
     505/**
    520506 * Got a frame from the lwIP stack, feed it to the internal network.
    521507 */
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