Changeset 55797 in vbox
- Timestamp:
- May 11, 2015 3:10:42 AM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 100225
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/HostDnsService.cpp
r55278 r55797 41 41 42 42 43 bool HostDnsInformation::equals(const HostDnsInformation &info, bool fDNSOrderIgnore) const 44 { 45 if (fDNSOrderIgnore) 43 bool 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 46 51 { 47 52 std::set<std::string> l(servers.begin(), servers.end()); 48 53 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); 53 63 } 54 64 else 55 65 { 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; 60 70 } 61 71 … … 73 83 Data(bool aThreaded) 74 84 : uLastExtraDataPoll(0), 75 f DNSOrderIgnore(false),85 fLaxComparison(0), 76 86 fThreaded(aThreaded), 77 87 virtualbox(NULL) … … 81 91 HostDnsInformation info; 82 92 uint64_t uLastExtraDataPoll; 83 bool fDNSOrderIgnore;93 uint32_t fLaxComparison; 84 94 const bool fThreaded; 85 95 RTTHREAD hMonitoringThread; … … 201 211 dumpHostDnsInformation(info); 202 212 203 bool fIgnore = m->f DNSOrderIgnore && info.equals(m->info, m->fDNSOrderIgnore);213 bool fIgnore = m->fLaxComparison && info.equals(m->info, m->fLaxComparison); 204 214 m->info = info; 205 215 206 216 if (fIgnore) 207 217 { 208 LogRel(("HostDnsMonitor: order change only, not notifying\n"));218 LogRel(("HostDnsMonitor: lax comparison %#x, not notifying\n", m->fLaxComparison)); 209 219 return; 210 220 } … … 244 254 m->uLastExtraDataPoll = uNow; 245 255 256 /* 257 * Should we ignore the order of DNS servers? 258 */ 246 259 const com::Bstr bstrHostDNSOrderIgnoreKey("VBoxInternal2/HostDNSOrderIgnore"); 247 260 com::Bstr bstrHostDNSOrderIgnore; 248 261 m->virtualbox->GetExtraData(bstrHostDNSOrderIgnoreKey.raw(), 249 262 bstrHostDNSOrderIgnore.asOutParam()); 250 bool fDNSOrderIgnore = false;263 uint32_t fDNSOrderIgnore = 0; 251 264 if (bstrHostDNSOrderIgnore.isNotEmpty()) 252 265 { 253 266 if (bstrHostDNSOrderIgnore != "0") 254 fDNSOrderIgnore = true;267 fDNSOrderIgnore = HostDnsInformation::IGNORE_SERVER_ORDER; 255 268 } 256 269 257 if (fDNSOrderIgnore != m->fDNSOrderIgnore)270 if (fDNSOrderIgnore != (m->fLaxComparison & HostDnsInformation::IGNORE_SERVER_ORDER)) 258 271 { 259 m->fDNSOrderIgnore = fDNSOrderIgnore; 272 273 m->fLaxComparison ^= HostDnsInformation::IGNORE_SERVER_ORDER; 260 274 LogRel(("HostDnsMonitor: %ls=%ls\n", 261 275 bstrHostDNSOrderIgnoreKey.raw(), 262 276 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())); 263 300 } 264 301 } -
trunk/src/VBox/Main/src-server/HostDnsService.h
r55278 r55797 36 36 { 37 37 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: 38 42 std::vector<std::string> servers; 39 43 std::string domain; 40 44 std::vector<std::string> searchList; 41 bool equals(const HostDnsInformation &, bool fDNSOrderIgnore = false) const;45 bool equals(const HostDnsInformation &, uint32_t fLaxComparison = 0) const; 42 46 }; 43 47
Note:
See TracChangeset
for help on using the changeset viewer.