VirtualBox

Changeset 48526 in vbox for trunk


Ignore:
Timestamp:
Sep 18, 2013 5:31:56 PM (11 years ago)
Author:
vboxsync
Message:

Network/NAT: Forward port latest changes from 4.2 to switch out of host resolver mode whenever possible and trigger a reconnect only if there is a DNS server available

Location:
trunk/src/VBox/Devices/Network
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/DrvNAT.cpp

    r48150 r48526  
    965965    PDRVNAT pThis = (PDRVNAT)pvUser;
    966966
    967     pThis->pIAboveConfig->pfnSetLinkState(pThis->pIAboveConfig, PDMNETWORKLINKSTATE_DOWN_RESUME);
     967    LogRel(("NAT: DNS servers changed, triggering reconnect\n"));
     968
     969    CFDictionaryRef hDnsDict = (CFDictionaryRef)SCDynamicStoreCopyValue(hDynStor, CFSTR("State:/Network/Global/DNS"));
     970    if (hDnsDict)
     971    {
     972        CFArrayRef hArrAddresses = (CFArrayRef)CFDictionaryGetValue(hDnsDict, kSCPropNetDNSServerAddresses);
     973        if (hArrAddresses)
     974            pThis->pIAboveConfig->pfnSetLinkState(pThis->pIAboveConfig, PDMNETWORKLINKSTATE_DOWN_RESUME);
     975
     976        CFRelease(hDnsDict);
     977    }
    968978}
    969979#endif
  • trunk/src/VBox/Devices/Network/slirp/bootp.c

    r44528 r48526  
    698698     * within transaction), assuming that transaction can't be longer than 1 min.
    699699     */
    700     if (   !pData->fUseHostResolver
     700    if (   !pData->fUseHostResolverPermanent
    701701        && (   pData->dnsLastUpdate == 0
    702             || curtime - pData->dnsLastUpdate > 60 * 1000)) /* one minute*/
     702            || curtime - pData->dnsLastUpdate > 60 * 1000
     703            || pData->fUseHostResolver)) /* one minute*/
    703704    {
    704705        uint8_t i = 2; /* i = 0 - tag, i == 1 - length */
  • trunk/src/VBox/Devices/Network/slirp/dnsproxy/dnsproxy.c

    r47702 r48526  
    362362            static int fail_counter = 0;
    363363            RTMemFree(req);
     364            /** @todo: This is completely bogus, fail_counter will always be 0. */
    364365            if (fail_counter == 0)
    365366              LogRel(("NAT/dnsproxy: Empty DNS entry (suppressed 100 times)\n"));
  • trunk/src/VBox/Devices/Network/slirp/slirp.c

    r48493 r48526  
    305305    pData->fPassDomain = !fUseHostResolver ? fPassDomain : false;
    306306    pData->fUseHostResolver = fUseHostResolver;
     307    pData->fUseHostResolverPermanent = fUseHostResolver;
    307308    pData->pvUser = pvUser;
    308309    pData->netmask = u32Netmask;
  • trunk/src/VBox/Devices/Network/slirp/slirp_dns.c

    r43714 r48526  
    337337    AssertPtrReturn(pData, VERR_INVALID_PARAMETER);
    338338    LogFlowFuncEnter();
    339     if (!pData->fUseHostResolver)
     339    if (!pData->fUseHostResolverPermanent)
    340340    {
    341341        TAILQ_INIT(&pData->pDnsList);
     
    346346         */
    347347        if (get_dns_addr_domain(pData, NULL) < 0)
    348             pData->fUseHostResolver = 1;
     348        {
     349            /* Load the DNS handler if host resolver mode was not used before. */
     350            if (!pData->fUseHostResolver)
     351                dns_alias_load(pData);
     352            pData->fUseHostResolver = true;
     353        }
    349354        else
     355        {
     356            /* Unload to not intercept in the future. */
     357            if (pData->fUseHostResolver)
     358                dns_alias_unload(pData);
     359            pData->fUseHostResolver = false;
    350360            dnsproxy_init(pData);
     361        }
    351362
    352363        if (!pData->fUseHostResolver)
  • trunk/src/VBox/Devices/Network/slirp/slirp_state.h

    r46593 r48526  
    247247    uma_zone_t zone_ext_refcnt;
    248248    bool fUseHostResolver;
     249    /** Flag whether using the host resolver mode is permanent
     250     * because the user configured it that way. */
     251    bool fUseHostResolverPermanent;
    249252    /* from dnsproxy/dnsproxy.h*/
    250253    unsigned int authoritative_port;
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