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

Side by Side Diff: runtime/bin/socket_linux.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 | « no previous file | runtime/bin/socket_macos.cc » ('j') | 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_LINUX) 6 #if defined(TARGET_OS_LINUX)
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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 SOL_TCP, 405 SOL_TCP,
402 TCP_NODELAY, 406 TCP_NODELAY,
403 reinterpret_cast<char *>(&on), 407 reinterpret_cast<char *>(&on),
404 sizeof(on))) == 0; 408 sizeof(on))) == 0;
405 } 409 }
406 410
407 } // namespace bin 411 } // namespace bin
408 } // namespace dart 412 } // namespace dart
409 413
410 #endif // defined(TARGET_OS_LINUX) 414 #endif // defined(TARGET_OS_LINUX)
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/socket_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698