VirtualBox

Changeset 50672 in vbox


Ignore:
Timestamp:
Mar 4, 2014 1:34:15 AM (11 years ago)
Author:
vboxsync
Message:

NAT(bootp.c, slirp.c): Handling Sleep/Resume with network change and runtime network change in DNS proxy mode enabled.

  1. built-in DHCP server shouldn't re-fetch DNS in case if NAT/Slirp receives DNS update from OS.
  2. if domain name has been changed and NAT/Slirp is in DNS proxy mode, VBOX_NAT_HNCE_EXSPOSED_NAME_RESOLUTION_INFO strategy should be selected, to force client update DHCP lease with new DNS settings.
Location:
trunk/src/VBox/Devices/Network/slirp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/slirp/bootp.c

    r50156 r50672  
    4242 */
    4343#include <slirp.h>
     44#include <libslirp.h>
    4445
    4546/** Entry in the table of known DHCP clients. */
     
    698699     * within transaction), assuming that transaction can't be longer than 1 min.
    699700     *
     701     * @note: if we have notification update (HAVE_NOTIFICATION_FOR_DNS_UPDATE)
     702     * provided by host, we don't need implicitly re-initialize dns list.
     703     *
    700704     * @note: NATState::fUseHostResolver became (r89055) the flag signalling that Slirp
    701705     * wasn't able to fetch fresh host DNS info and fall down to use host-resolver, on one
     
    705709     * wanted by user ASAP (P here when host serialize its  configuration in files parsed by Slirp).
    706710     */
    707     if (   !pData->fUseHostResolverPermanent
     711    if (   !HAVE_NOTIFICATION_FOR_DNS_UPDATE
     712        && !pData->fUseHostResolverPermanent
    708713        && (   pData->dnsLastUpdate == 0
    709714            || curtime - pData->dnsLastUpdate > 60 * 1000 /* one minute */
     
    716721            if (parameter_list[i] == RFC1533_DNS)
    717722            {
     723                /* XXX: How differs it from host Suspend/Resume? */
    718724                slirpReleaseDnsSettings(pData);
    719725                slirpInitializeDnsSettings(pData);
  • trunk/src/VBox/Devices/Network/slirp/slirp.c

    r50669 r50672  
    6464
    6565#ifndef RT_OS_WINDOWS
    66 
     66/**
     67 * XXX: It shouldn't be non-Windows specific.
     68 * resolv_conf_parser.h client's structure isn't OS specific, it's just need to be generalized a
     69 * a bit to replace slirp_state.h DNS server (domain) lists with rcp_state like structure. 
     70 */
     71# include "resolv_conf_parser.h"
     72#endif
     73
     74#ifndef RT_OS_WINDOWS
    6775# define DO_ENGAGE_EVENT1(so, fdset, label)                        \
    6876   do {                                                            \
     
    20392047}
    20402048
    2041 
     2049/**
     2050 * @note: NATState::fUseHostResolver could be changed in bootp.c::dhcp_decode
     2051 * @note: this function is executed on GUI/VirtualBox or main/VBoxHeadless thread.
     2052 * @note: this function can potentially race with bootp.c::dhcp_decode (except Darwin)
     2053 */
    20422054int slirp_host_network_configuration_change_strategy_selector(const PNATState pData)
    20432055{
    2044     if (pData->fUseHostResolver) return VBOX_NAT_HNCE_HOSTRESOLVER;
    2045     if (pData->fUseDnsProxy) return VBOX_NAT_HNCE_DNSPROXY;
     2056    if (pData->fUseHostResolverPermanent) return VBOX_NAT_HNCE_HOSTRESOLVER;
     2057    if (pData->fUseDnsProxy) {
     2058#if HAVE_NOTIFICATION_FOR_DNS_UPDATE
     2059        /* We dont conflict with bootp.c::dhcp_decode */
     2060        struct rcp_state rcp_state;
     2061        int rc;
     2062       
     2063        rcp_state.rcps_flags |= RCPSF_IGNORE_IPV6;
     2064        rc = rcp_parse(&rcp_state, RESOLV_CONF_FILE);
     2065        LogRelFunc(("NAT: rcp_parse:%Rrc old domain:%s new domain:%s\n",
     2066                    rc, LIST_FIRST(&pData->pDomainList)->dd_pszDomain,
     2067                    rcp_state.rcps_domain));
     2068        if (   RT_FAILURE(rc)
     2069            || LIST_EMPTY(&pData->pDomainList))
     2070            return VBOX_NAT_HNCE_DNSPROXY;
     2071       
     2072        if (   rcp_state.rcps_domain
     2073            && strcmp(rcp_state.rcps_domain, LIST_FIRST(&pData->pDomainList)->dd_pszDomain) == 0)
     2074            return VBOX_NAT_HNCE_DNSPROXY;
     2075        else
     2076            return VBOX_NAT_HNCE_EXSPOSED_NAME_RESOLUTION_INFO; /* XXX: rename it */
     2077#else
     2078        /* copy domain name */
     2079        /* domain only compare with coy version */
     2080        return VBOX_NAT_HNCE_DNSPROXY;
     2081#endif
     2082    }
    20462083    return VBOX_NAT_HNCE_EXSPOSED_NAME_RESOLUTION_INFO;
    20472084}
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