VirtualBox

Changeset 48417 in vbox for trunk/src/VBox/Main/src-server


Ignore:
Timestamp:
Sep 10, 2013 3:58:39 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
88857
Message:

Main/NATNetworkImpl: accept hint for address selection returning default value or assigning available.

File:
1 edited

Legend:

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

    r48415 r48417  
    904904
    905905
    906 int NATNetwork::findFirstAvailableOffset(uint32_t *poff)
     906int NATNetwork::findFirstAvailableOffset(ADDRESSLOOKUPTYPE addrType, uint32_t *poff)
    907907{
    908908    RTNETADDRIPV4 network, netmask;
     
    918918    {
    919919
    920         if (off == m->offGateway)
    921             continue;
    922 
    923         if (off == m->offDhcp)
    924             continue;
    925        
    926920        bool skip = false;
    927921        for (it = m->llNATLoopbackOffsetList.begin();
     
    937931        }
    938932       
     933        if (skip)
     934            continue;
     935
     936        if (off == m->offGateway)
     937        {
     938            if (addrType == ADDR_GATEWAY)
     939                break;
     940            else
     941                continue;
     942        }
     943
     944        if (off == m->offDhcp)
     945        {
     946            if (addrType == ADDR_DHCP)
     947                break;
     948            else
     949                continue;
     950        }
     951
    939952        if (!skip)
    940953            break;
     
    955968    AssertRCReturn(rc, rc);
    956969
    957     findFirstAvailableOffset(&m->offGateway);
     970    findFirstAvailableOffset(ADDR_GATEWAY, &m->offGateway);
    958971    if (m->fNeedDhcpServer)
    959         findFirstAvailableOffset(&m->offDhcp);
     972        findFirstAvailableOffset(ADDR_DHCP, &m->offDhcp);
    960973
    961974    /* I don't remember the reason CIDR calculated on the host. */
     
    975988        RTNETADDRIPV4 dhcplowerip = network;
    976989        uint32_t offDhcpLowerIp;
    977         findFirstAvailableOffset(&offDhcpLowerIp);
     990        findFirstAvailableOffset(ADDR_DHCPLOWERIP, &offDhcpLowerIp);
    978991        dhcplowerip.u = RT_H2N_U32(dhcplowerip.u + offDhcpLowerIp);
    979992
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