VirtualBox

Changeset 49918 in vbox


Ignore:
Timestamp:
Dec 16, 2013 7:56:51 AM (11 years ago)
Author:
vboxsync
Message:

VBoxNetDHCP: Leases shouldn't cache settings which are could be changed at run-time, e.g. DNS settings.

Location:
trunk/src/VBox/NetworkServices/DHCP
Files:
2 edited

Legend:

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

    r49735 r49918  
    773773    RT_ZERO(opt);
    774774
    775     std::vector<RawOption> extra(2);
     775    std::vector<RawOption> extra;
    776776    opt.u8OptId = RTNET_DHCP_OPT_MSG_TYPE;
    777777    opt.au8RawOpt[0] = RTNET_DHCP_MT_OFFER;
     
    789789    extra.push_back(opt);
    790790
    791     processParameterReqList(client, pu8ReqList, cReqList);
     791    processParameterReqList(client, pu8ReqList, cReqList, extra);
    792792
    793793    return doReply(client, extra);
     
    826826    RT_ZERO(opt);
    827827
    828     std::vector<RawOption> extra(2);
     828    std::vector<RawOption> extra;
    829829    opt.u8OptId = RTNET_DHCP_OPT_MSG_TYPE;
    830830    opt.au8RawOpt[0] = RTNET_DHCP_MT_ACK;
     
    841841    extra.push_back(opt);
    842842
    843     processParameterReqList(client, pu8ReqList, cReqList);
     843    processParameterReqList(client, pu8ReqList, cReqList, extra);
    844844
    845845    return doReply(client, extra);
     
    979979
    980980
    981 int NetworkManager::processParameterReqList(const Client& client, uint8_t *pu8ReqList, int cReqList)
    982 {
     981int NetworkManager::processParameterReqList(const Client& client, const uint8_t *pu8ReqList,
     982                                            int cReqList, std::vector<RawOption>& extra)
     983{
     984    const Lease l = client.lease();
     985   
     986    const NetworkConfigEntity *pNetCfg = l.getConfig();
     987
    983988    /* request parameter list */
    984989    RawOption opt;
    985     int idxParam = 0;
    986 
    987     uint8_t *pReqList = pu8ReqList;
    988    
    989     const Lease const_l = client.lease();
    990     Lease l = Lease(const_l);
    991    
    992     const NetworkConfigEntity *pNetCfg = l.getConfig();
    993 
    994     for (idxParam = 0; idxParam < cReqList; ++idxParam)
    995     {
    996 
    997         bool fIgnore = false;
     990    bool fIgnore;
     991    uint8_t u8Req;
     992    for (int idxParam = 0; idxParam < cReqList; ++idxParam)
     993    {
     994        fIgnore = false;
    998995        RT_ZERO(opt);
    999         opt.u8OptId = pReqList[idxParam];
    1000 
    1001         switch(pReqList[idxParam])
     996        u8Req = opt.u8OptId = pu8ReqList[idxParam];
     997
     998        switch(u8Req)
    1002999        {
    10031000            case RTNET_DHCP_OPT_SUBNET_MASK:
     
    10111008                {
    10121009                    const Ipv4AddressContainer lst =
    1013                       g_ConfigurationManager->getAddressList(pReqList[idxParam]);
     1010                      g_ConfigurationManager->getAddressList(u8Req);
    10141011                    PRTNETADDRIPV4 pAddresses = (PRTNETADDRIPV4)&opt.au8RawOpt[0];
    10151012
     
    10291026            case RTNET_DHCP_OPT_DOMAIN_NAME:
    10301027                {
    1031                     std::string domainName = g_ConfigurationManager->getString(pReqList[idxParam]);
     1028                    std::string domainName = g_ConfigurationManager->getString(u8Req);
    10321029                    if (domainName == g_ConfigurationManager->m_noString)
    10331030                    {
     
    10431040                break;
    10441041            default:
    1045                 Log(("opt: %d is ignored\n", pReqList[idxParam]));
     1042                Log(("opt: %d is ignored\n", u8Req));
    10461043                fIgnore = true;
    10471044                break;
     
    10491046
    10501047        if (!fIgnore)
    1051             l.options().insert(std::map<uint8_t, RawOption>::value_type(opt.u8OptId, opt));
     1048            extra.push_back(opt);
    10521049
    10531050    }
     
    12201217
    12211218const MapOptionId2RawOption& Lease::options() const
    1222 {
    1223     return m->options;
    1224 }
    1225 
    1226 
    1227 MapOptionId2RawOption& Lease::options()
    12281219{
    12291220    return m->options;
  • trunk/src/VBox/NetworkServices/DHCP/Config.h

    r49821 r49918  
    133133
    134134    const MapOptionId2RawOption& options() const;
    135     MapOptionId2RawOption& options();
    136135
    137136    bool toXML(xml::ElementNode *) const;
     
    516515    int prepareReplyPacket4Client(const Client& client, uint32_t u32Xid);
    517516    int doReply(const Client& client, const std::vector<RawOption>& extra);
    518     int processParameterReqList(const Client& client, uint8_t *pu8ReqList, int cReqList);
     517    int processParameterReqList(const Client& client, const uint8_t *pu8ReqList, int cReqList, std::vector<RawOption>& extra);
    519518
    520519private:
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