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

Issue 7612012: Cleanup GetNetworkList. (Closed)

Created:
9 years, 4 months ago by Wez
Modified:
9 years, 4 months ago
Reviewers:
Sergey Ulanov, wtc
CC:
chromium-reviews, cbentzel+watch_chromium.org, darin-cc_chromium.org
Visibility:
Public.

Description

Cleanup GetNetworkList. BUG= TEST= Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=96993

Patch Set 1 #

Total comments: 2

Patch Set 2 : Address comments. #

Patch Set 3 : Rebase. #

Total comments: 1

Patch Set 4 : Address comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+41 lines, -15 lines) Patch
M net/base/net_util_posix.cc View 1 2 3 2 chunks +41 lines, -15 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
Wez
Revision to GetNetworkList() to make use of the LOOPBACK flag, and to filter out loopback ...
9 years, 4 months ago (2011-08-11 00:07:37 UTC) #1
Sergey Ulanov
LGTM with two nits. http://codereview.chromium.org/7612012/diff/1/net/base/net_util_posix.cc File net/base/net_util_posix.cc (right): http://codereview.chromium.org/7612012/diff/1/net/base/net_util_posix.cc#newcode22 net/base/net_util_posix.cc:22: //#include <netdb.h> remove commented line. ...
9 years, 4 months ago (2011-08-11 02:06:37 UTC) #2
commit-bot: I haz the power
Presubmit check for 7612012-6001 failed and returned exit status 1. Running presubmit commit checks ...
9 years, 4 months ago (2011-08-13 04:42:13 UTC) #3
Wez
wtc: This is a follow up to the quick-fix for GetNetworkList() you reviewed the other ...
9 years, 4 months ago (2011-08-13 04:45:13 UTC) #4
wtc
9 years, 4 months ago (2011-08-15 22:38:31 UTC) #5
LGTM.

http://codereview.chromium.org/7612012/diff/6001/net/base/net_util_posix.cc
File net/base/net_util_posix.cc (right):

http://codereview.chromium.org/7612012/diff/6001/net/base/net_util_posix.cc#n...
net/base/net_util_posix.cc:111: sizeof(interface->ifa_addr))) {
Change interface->ifa_addr (two occurrences) to your local
variable 'addr'.

BUG: the second argument to address.FromSockAddr() is wrong.
It should be the size of the particular kind of sockaddr
structure.  So it should be
  sizeof(struct sockaddr_in6)
or
  sizeof(struct sockaddr_in)
depending on the value of addr->sa_family.

What you're passing here, sizeof(interface->ifa_addr),
is the size of a pointer.

The reason it works is that address.FromSockAddr()
ignores the second argument.  Sigh.

I think you should pass a value that's more "correct",
such as sizeof(*addr) (note the '*'), or a value that's
clearly wrong, such as 0.  I would use a local variable
size_t address_length that's set in the if-else-if statement
on lines 93-103 above.

Powered by Google App Engine
This is Rietveld 408576698