VirtualBox

Changeset 55797 in vbox


Ignore:
Timestamp:
May 11, 2015 3:10:42 AM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
100225
Message:

Main/HostDnsService: if VBoxInternal2/HostDNSSuffixesIgnore global
extradata is set to a value other than "0", don't send notification
when only the domain or DNS search list changed.

Location:
trunk/src/VBox/Main/src-server
Files:
2 edited

Legend:

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

    r55278 r55797  
    4141
    4242
    43 bool HostDnsInformation::equals(const HostDnsInformation &info, bool fDNSOrderIgnore) const
    44 {
    45     if (fDNSOrderIgnore)
     43bool HostDnsInformation::equals(const HostDnsInformation &info, uint32_t fLaxComparison) const
     44{
     45    bool fSameServers;
     46    if ((fLaxComparison & IGNORE_SERVER_ORDER) == 0)
     47    {
     48        fSameServers = (servers == info.servers);
     49    }
     50    else
    4651    {
    4752        std::set<std::string> l(servers.begin(), servers.end());
    4853        std::set<std::string> r(info.servers.begin(), info.servers.end());
    49 
    50         return (l == r)
    51             && (domain == info.domain)
    52             && (searchList == info.searchList); // XXX: also ignore order?
     54       
     55        fSameServers = (l == r);
     56    }
     57
     58    bool fSameDomain, fSameSearchList;
     59    if ((fLaxComparison & IGNORE_SUFFIXES) == 0)
     60    {
     61        fSameDomain = (domain == info.domain);
     62        fSameSearchList = (searchList == info.searchList);
    5363    }
    5464    else
    5565    {
    56         return (servers == info.servers)
    57             && (domain == info.domain)
    58             && (searchList == info.searchList);
    59     }
     66        fSameDomain = fSameSearchList = true;
     67    }
     68
     69    return fSameServers && fSameDomain && fSameSearchList;
    6070}
    6171
     
    7383    Data(bool aThreaded)
    7484      : uLastExtraDataPoll(0),
    75         fDNSOrderIgnore(false),
     85        fLaxComparison(0),
    7686        fThreaded(aThreaded),
    7787        virtualbox(NULL)
     
    8191    HostDnsInformation info;
    8292    uint64_t uLastExtraDataPoll;
    83     bool fDNSOrderIgnore;
     93    uint32_t fLaxComparison;
    8494    const bool fThreaded;
    8595    RTTHREAD hMonitoringThread;
     
    201211    dumpHostDnsInformation(info);
    202212
    203     bool fIgnore = m->fDNSOrderIgnore && info.equals(m->info, m->fDNSOrderIgnore);
     213    bool fIgnore = m->fLaxComparison && info.equals(m->info, m->fLaxComparison);
    204214    m->info = info;
    205215
    206216    if (fIgnore)
    207217    {
    208         LogRel(("HostDnsMonitor: order change only, not notifying\n"));
     218        LogRel(("HostDnsMonitor: lax comparison %#x, not notifying\n", m->fLaxComparison));
    209219        return;
    210220    }
     
    244254        m->uLastExtraDataPoll = uNow;
    245255
     256        /*
     257         * Should we ignore the order of DNS servers?
     258         */
    246259        const com::Bstr bstrHostDNSOrderIgnoreKey("VBoxInternal2/HostDNSOrderIgnore");
    247260        com::Bstr bstrHostDNSOrderIgnore;
    248261        m->virtualbox->GetExtraData(bstrHostDNSOrderIgnoreKey.raw(),
    249262                                    bstrHostDNSOrderIgnore.asOutParam());
    250         bool fDNSOrderIgnore = false;
     263        uint32_t fDNSOrderIgnore = 0;
    251264        if (bstrHostDNSOrderIgnore.isNotEmpty())
    252265        {
    253266            if (bstrHostDNSOrderIgnore != "0")
    254                 fDNSOrderIgnore = true;
     267                fDNSOrderIgnore = HostDnsInformation::IGNORE_SERVER_ORDER;
    255268        }
    256269
    257         if (fDNSOrderIgnore != m->fDNSOrderIgnore)
     270        if (fDNSOrderIgnore != (m->fLaxComparison & HostDnsInformation::IGNORE_SERVER_ORDER))
    258271        {
    259             m->fDNSOrderIgnore = fDNSOrderIgnore;
     272
     273            m->fLaxComparison ^= HostDnsInformation::IGNORE_SERVER_ORDER;
    260274            LogRel(("HostDnsMonitor: %ls=%ls\n",
    261275                    bstrHostDNSOrderIgnoreKey.raw(),
    262276                    bstrHostDNSOrderIgnore.raw()));
     277        }
     278
     279        /*
     280         * Should we ignore changes to the domain name or the search list?
     281         */
     282        const com::Bstr bstrHostDNSSuffixesIgnoreKey("VBoxInternal2/HostDNSSuffixesIgnore");
     283        com::Bstr bstrHostDNSSuffixesIgnore;
     284        m->virtualbox->GetExtraData(bstrHostDNSSuffixesIgnoreKey.raw(),
     285                                    bstrHostDNSSuffixesIgnore.asOutParam());
     286        uint32_t fDNSSuffixesIgnore = 0;
     287        if (bstrHostDNSSuffixesIgnore.isNotEmpty())
     288        {
     289            if (bstrHostDNSSuffixesIgnore != "0")
     290                fDNSSuffixesIgnore = HostDnsInformation::IGNORE_SUFFIXES;
     291        }
     292
     293        if (fDNSSuffixesIgnore != (m->fLaxComparison & HostDnsInformation::IGNORE_SUFFIXES))
     294        {
     295
     296            m->fLaxComparison ^= HostDnsInformation::IGNORE_SUFFIXES;
     297            LogRel(("HostDnsMonitor: %ls=%ls\n",
     298                    bstrHostDNSSuffixesIgnoreKey.raw(),
     299                    bstrHostDNSSuffixesIgnore.raw()));
    263300        }
    264301    }
  • trunk/src/VBox/Main/src-server/HostDnsService.h

    r55278 r55797  
    3636{
    3737  public:
     38    static const uint32_t IGNORE_SERVER_ORDER = RT_BIT_32(0);
     39    static const uint32_t IGNORE_SUFFIXES     = RT_BIT_32(1);
     40
     41  public:
    3842    std::vector<std::string> servers;
    3943    std::string domain;
    4044    std::vector<std::string> searchList;
    41     bool equals(const HostDnsInformation &, bool fDNSOrderIgnore = false) const;
     45    bool equals(const HostDnsInformation &, uint32_t fLaxComparison = 0) const;
    4246};
    4347
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