Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Side by Side Diff: net/base/host_resolver_proc.cc

Issue 8336024: OpenBSD patches for net, split from CR #8275005 (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: remove arpa/nameser.h Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/base/host_resolver_proc.h" 5 #include "net/base/host_resolver_proc.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "net/base/address_list.h" 10 #include "net/base/address_list.h"
11 #include "net/base/dns_reloader.h" 11 #include "net/base/dns_reloader.h"
12 #include "net/base/net_errors.h" 12 #include "net/base/net_errors.h"
13 #include "net/base/sys_addrinfo.h" 13 #include "net/base/sys_addrinfo.h"
14 14
15 #if defined(OS_POSIX) && !defined(OS_MACOSX) 15 #if defined(OS_OPENBSD)
16 #include <resolv.h> 16 #define AI_ADDRCONFIG 0
17 #endif 17 #endif
18 18
19 namespace net { 19 namespace net {
20 20
21 namespace { 21 namespace {
22 22
23 bool IsAllLocalhostOfOneFamily(const struct addrinfo* ai) { 23 bool IsAllLocalhostOfOneFamily(const struct addrinfo* ai) {
24 bool saw_v4_localhost = false; 24 bool saw_v4_localhost = false;
25 bool saw_v6_localhost = false; 25 bool saw_v6_localhost = false;
26 for (; ai != NULL; ai = ai->ai_next) { 26 for (; ai != NULL; ai = ai->ai_next) {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 hints.ai_family = AF_INET6; 136 hints.ai_family = AF_INET6;
137 break; 137 break;
138 case ADDRESS_FAMILY_UNSPECIFIED: 138 case ADDRESS_FAMILY_UNSPECIFIED:
139 hints.ai_family = AF_UNSPEC; 139 hints.ai_family = AF_UNSPEC;
140 break; 140 break;
141 default: 141 default:
142 NOTREACHED(); 142 NOTREACHED();
143 hints.ai_family = AF_UNSPEC; 143 hints.ai_family = AF_UNSPEC;
144 } 144 }
145 145
146 #if defined(OS_WIN) || defined(OS_OPENBSD) 146 #if defined(OS_WIN)
147 // DO NOT USE AI_ADDRCONFIG ON WINDOWS. 147 // DO NOT USE AI_ADDRCONFIG ON WINDOWS.
148 // 148 //
149 // The following comment in <winsock2.h> is the best documentation I found 149 // The following comment in <winsock2.h> is the best documentation I found
150 // on AI_ADDRCONFIG for Windows: 150 // on AI_ADDRCONFIG for Windows:
151 // Flags used in "hints" argument to getaddrinfo() 151 // Flags used in "hints" argument to getaddrinfo()
152 // - AI_ADDRCONFIG is supported starting with Vista 152 // - AI_ADDRCONFIG is supported starting with Vista
153 // - default is AI_ADDRCONFIG ON whether the flag is set or not 153 // - default is AI_ADDRCONFIG ON whether the flag is set or not
154 // because the performance penalty in not having ADDRCONFIG in 154 // because the performance penalty in not having ADDRCONFIG in
155 // the multi-protocol stack environment is severe; 155 // the multi-protocol stack environment is severe;
156 // this defaulting may be disabled by specifying the AI_ALL flag, 156 // this defaulting may be disabled by specifying the AI_ALL flag,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 #endif 232 #endif
233 233
234 return ERR_NAME_NOT_RESOLVED; 234 return ERR_NAME_NOT_RESOLVED;
235 } 235 }
236 236
237 *addrlist = AddressList::CreateByAdoptingFromSystem(ai); 237 *addrlist = AddressList::CreateByAdoptingFromSystem(ai);
238 return OK; 238 return OK;
239 } 239 }
240 240
241 } // namespace net 241 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698