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

Side by Side Diff: runtime/bin/socket_macos.cc

Issue 18268003: Take into account virtual devices (e.g. OpenVPN tun0) when iterating network (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « runtime/bin/socket_linux.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_MACOS) 6 #if defined(TARGET_OS_MACOS)
7 7
8 #include <errno.h> // NOLINT 8 #include <errno.h> // NOLINT
9 #include <stdio.h> // NOLINT 9 #include <stdio.h> // NOLINT
10 #include <stdlib.h> // NOLINT 10 #include <stdlib.h> // NOLINT
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 *os_error = new OSError(status, 239 *os_error = new OSError(status,
240 gai_strerror(status), 240 gai_strerror(status),
241 OSError::kGetAddressInfo); 241 OSError::kGetAddressInfo);
242 return false; 242 return false;
243 } 243 }
244 return true; 244 return true;
245 } 245 }
246 246
247 247
248 static bool ShouldIncludeIfaAddrs(struct ifaddrs* ifa, int lookup_family) { 248 static bool ShouldIncludeIfaAddrs(struct ifaddrs* ifa, int lookup_family) {
249 if (ifa->ifa_addr == NULL) {
250 // OpenVPN's virtual device tun0.
251 return false;
252 }
249 int family = ifa->ifa_addr->sa_family; 253 int family = ifa->ifa_addr->sa_family;
250 if (lookup_family == family) return true; 254 if (lookup_family == family) return true;
251 if (lookup_family == AF_UNSPEC && 255 if (lookup_family == AF_UNSPEC &&
252 (family == AF_INET || family == AF_INET6)) { 256 (family == AF_INET || family == AF_INET6)) {
253 return true; 257 return true;
254 } 258 }
255 return false; 259 return false;
256 } 260 }
257 261
258 262
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 IPPROTO_TCP, 395 IPPROTO_TCP,
392 TCP_NODELAY, 396 TCP_NODELAY,
393 reinterpret_cast<char *>(&on), 397 reinterpret_cast<char *>(&on),
394 sizeof(on))) == 0; 398 sizeof(on))) == 0;
395 } 399 }
396 400
397 } // namespace bin 401 } // namespace bin
398 } // namespace dart 402 } // namespace dart
399 403
400 #endif // defined(TARGET_OS_MACOS) 404 #endif // defined(TARGET_OS_MACOS)
OLDNEW
« no previous file with comments | « runtime/bin/socket_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698