MCPcopy Create free account
hub / github.com/apache/impala / IsTrustedConnection

Method IsTrustedConnection

be/src/kudu/rpc/server_negotiation.cc:1093–1118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1091}
1092
1093bool ServerNegotiation::IsTrustedConnection(const Sockaddr& addr) {
1094 if (addr.family() == AF_UNIX) {
1095 return true;
1096 }
1097
1098 static std::once_flag once;
1099 std::call_once(once, [] {
1100 g_trusted_subnets = new vector<Network>();
1101 CHECK_OK(Network::ParseCIDRStrings(FLAGS_trusted_subnets, g_trusted_subnets));
1102
1103 // If --trusted_subnets is not set explicitly, local subnets of all local network
1104 // interfaces as well as the default private subnets will be used.
1105 if (google::GetCommandLineFlagInfoOrDie("trusted_subnets").is_default) {
1106 std::vector<Network> local_networks;
1107 WARN_NOT_OK(GetLocalNetworks(&local_networks),
1108 "Unable to get local networks.");
1109
1110 g_trusted_subnets->insert(g_trusted_subnets->end(),
1111 local_networks.begin(),
1112 local_networks.end());
1113 }
1114 });
1115
1116 return std::any_of(g_trusted_subnets->begin(), g_trusted_subnets->end(),
1117 [&](const Network& t) { return t.WithinNetwork(addr); });
1118}
1119
1120} // namespace rpc
1121} // namespace kudu

Callers

nothing calls this directly

Calls 6

GetLocalNetworksFunction · 0.85
WithinNetworkMethod · 0.80
familyMethod · 0.45
insertMethod · 0.45
endMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected