Adar Dembo has posted comments on this change. ( )

Change subject: KUDU-1900: add loopback check and test

Patch Set 2:

File src/kudu/integration-tests/
PS2, Line 18: #include <arpa/inet.h>
            : #include <ifaddrs.h>
Is this approach portable to macOS?
PS2, Line 331: INSTANTIATE_TEST_CASE_P(, AuthTokenIssuingTest, 
Would it be possible to use ::testing::Combine() to generate this more clearly? 
Could we structure the generators such that we get the right combinations (i.e. 
nearly the Cartesian product)?
PS2, Line 376:   // an extnernal IP, so that the connection is not considered  
to be local
PS2, Line 378:     struct ifaddrs *ifap = nullptr;
The initialization isn't necessary; getifaddrs() is going to overwrite 'ifap'.
PS2, Line 380:     if (getifaddrs(&ifap) > -1) {
Would be cleaner if this could early-out rather than introduce a new nested 
scope. Maybe decompose all of this into a helper method?
PS2, Line 382:         if (ifa->ifa_addr == nullptr || ifa->ifa_netmask == 
nullptr || ifa->ifa_addr->sa_family != AF_INET) continue;
Wrap, too long.
PS2, Line 383:         struct sockaddr_in *addr_in = (struct sockaddr_in 
Use C++-style casts here (static_cast or reinterpret_cast).
PS2, Line 388:           FLAGS_local_ip_for_outbound_sockets.assign(s, 
Probably clearer as:

  FLAGS_foo = string(s, arraysize(s));
PS2, Line 392:       freeifaddrs(ifap);
Use RAII principles: set up a SCOPED_CLEANUP that calls freeifaddrs() when it 
goes out of scope, declared just after getifaddrs() is known to have succeeded.
File src/kudu/util/net/
PS2, Line 302:   // Check if remote address is in subnet
Nit: terminate with a period.

Applies to the new comments in the test too.
PS2, Line 303: if(
Nit: if (remote

To view, visit
To unsubscribe, visit

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3483a9729ddeeb7901e3738532a45b49e713208f
Gerrit-Change-Number: 12474
Gerrit-PatchSet: 2
Gerrit-Owner: Greg Solovyev <>
Gerrit-Reviewer: Adar Dembo <>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Comment-Date: Wed, 13 Feb 2019 22:53:15 +0000
Gerrit-HasComments: Yes

Reply via email to