vbox的更動 64215 路徑 trunk/src/VBox/NetworkServices
- 時間撮記:
- 2016-10-12 上午02:05:31 (8 年 以前)
- 位置:
- trunk/src/VBox/NetworkServices
- 檔案:
-
- 修改 3 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp
r63301 r64215 115 115 int initWithMain(); 116 116 HRESULT HandleEvent(VBoxEventType_T aEventType, IEvent *pEvent); 117 118 static int hostDnsServers(const ComHostPtr& host, 119 const RTNETADDRIPV4& networkid, 120 /* const */ AddressToOffsetMapping& mapping, 121 AddressList& servers); 117 122 int fetchAndUpdateDnsInfo(); 118 123 … … 611 616 } 612 617 618 619 /** 620 * @note: const dropped here, because of map<K,V>::operator[] which 621 * isn't const, map<K,V>::at() has const variant but it's C++11. 622 */ 623 int VBoxNetDhcp::hostDnsServers(const ComHostPtr& host, 624 const RTNETADDRIPV4& networkid, 625 /* const */ AddressToOffsetMapping& mapping, 626 AddressList& servers) 627 { 628 ComBstrArray strs; 629 630 HRESULT hrc = host->COMGETTER(NameServers)(ComSafeArrayAsOutParam(strs)); 631 if (FAILED(hrc)) 632 return VERR_NOT_FOUND; 633 634 /* 635 * Recent fashion is to run dnsmasq on 127.0.1.1 which we 636 * currently can't map. If that's the only nameserver we've got, 637 * we need to use DNS proxy for VMs to reach it. 638 */ 639 bool fUnmappedLoopback = false; 640 641 for (size_t i = 0; i < strs.size(); ++i) 642 { 643 RTNETADDRIPV4 addr; 644 int rc; 645 646 rc = RTNetStrToIPv4Addr(com::Utf8Str(strs[i]).c_str(), &addr); 647 if (RT_FAILURE(rc)) 648 continue; 649 650 if (addr.au8[0] == 127) 651 { 652 /* XXX: here we want map<K,V>::at(const K& k) const */ 653 if (mapping[addr] != 0) 654 { 655 addr.u = RT_H2N_U32(RT_N2H_U32(networkid.u) 656 + mapping[addr]); 657 } 658 else 659 { 660 fUnmappedLoopback = true; 661 continue; 662 } 663 } 664 665 servers.push_back(addr); 666 } 667 668 if (servers.empty() && fUnmappedLoopback) 669 { 670 RTNETADDRIPV4 proxy; 671 672 proxy.u = networkid.u | RT_H2N_U32_C(1U); 673 servers.push_back(proxy); 674 } 675 676 return VINF_SUCCESS; 677 } 678 679 613 680 HRESULT VBoxNetDhcp::HandleEvent(VBoxEventType_T aEventType, IEvent *pEvent) 614 681 { -
trunk/src/VBox/NetworkServices/NetLib/ComHostUtils.cpp
r63275 r64215 119 119 } 120 120 121 /**122 * @note: const dropped here, because of map<K,V>::operator[] which isn't const, map<K,V>::at() has const123 * variant but it's C++11.124 */125 int hostDnsServers(const ComHostPtr& host, const RTNETADDRIPV4& networkid,126 /*const*/ AddressToOffsetMapping& mapping, AddressList& servers)127 {128 servers.clear();129 130 ComBstrArray strs;131 if (SUCCEEDED(host->COMGETTER(NameServers)(ComSafeArrayAsOutParam(strs))))132 {133 RTNETADDRIPV4 addr;134 int rc;135 136 for (unsigned int i = 0; i < strs.size(); ++i)137 {138 rc = RTNetStrToIPv4Addr(com::Utf8Str(strs[i]).c_str(), &addr);139 if (RT_SUCCESS(rc))140 {141 if (addr.au8[0] == 127)142 {143 /* XXX: here we want map<K,V>::at(const K& k) const */144 if (mapping[addr] != 0)145 {146 addr.u = RT_H2N_U32(RT_N2H_U32(networkid.u)147 + mapping[addr]);148 }149 else150 continue; /* XXX: Warning here (local mapping wasn't registered) */151 }152 153 servers.push_back(addr);154 }155 }156 }157 else158 return VERR_NOT_FOUND;159 160 return VINF_SUCCESS;161 }162 163 121 164 122 int hostDnsSearchList(const ComHostPtr& host, std::vector<std::string>& strings) -
trunk/src/VBox/NetworkServices/NetLib/utils.h
r63261 r64215 75 75 76 76 int localMappings(const ComNatPtr&, AddressToOffsetMapping&); 77 int hostDnsServers(const ComHostPtr&, const RTNETADDRIPV4&,/* const */ AddressToOffsetMapping&, AddressList&);78 77 int hostDnsSearchList(const ComHostPtr&, std::vector<std::string>&); 79 78 int hostDnsDomain(const ComHostPtr&, std::string& domainStr);
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器