Skip to content

Commit

Permalink
network: instrument first active interfaces when switching socket mod…
Browse files Browse the repository at this point in the history
…es (#1889)

Description: When switching from the default socket mode to alternate bound interface mode, this change adds extra information to the LOG_EVENT, capturing the first active interface for IPv4 and IPv6 meeting the selection criteria for the alternate network.
Risk Level: Low
Testing: CI

Signed-off-by: Mike Schore <mike.schore@gmail.com>
Signed-off-by: JP Simard <jp@jpsim.com>
  • Loading branch information
goaway authored and jpsim committed Nov 28, 2022
1 parent 2a59aed commit 6b6beaf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions mobile/library/common/engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ void Engine::logInterfaces() {
[](std::string acc, std::string next) {
return acc.empty() ? next : std::move(acc) + "," + next;
});
ENVOY_LOG_EVENT(debug, "network_configuration_get_v4_interfaces", v4_names);
ENVOY_LOG_EVENT(debug, "network_configuration_get_v6_interfaces", v6_names);
ENVOY_LOG_EVENT(debug, "netconf_get_v4_interfaces", v4_names);
ENVOY_LOG_EVENT(debug, "netconf_get_v6_interfaces", v6_names);
}

} // namespace Envoy
12 changes: 8 additions & 4 deletions mobile/library/common/network/configurator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,14 @@ void Configurator::reportNetworkUsage(envoy_netconf_t configuration_key, bool ne
? AlternateBoundInterfaceMode
: DefaultPreferredNetworkMode;
network_state_.remaining_faults_ = InitialFaultThreshold;
ENVOY_LOG_EVENT(debug, "netconf_mode_switch",
network_state_.socket_mode_ == DefaultPreferredNetworkMode
? "DefaultPreferredNetworkMode"
: "AlternateBoundInterfaceMode");
if (network_state_.socket_mode_ == DefaultPreferredNetworkMode) {
ENVOY_LOG_EVENT(debug, "netconf_mode_switch", "DefaultPreferredNetworkMode");
} else if (network_state_.socket_mode_ == AlternateBoundInterfaceMode) {
auto& v4_interface = getActiveAlternateInterface(network_state_.network_, AF_INET);
auto& v6_interface = getActiveAlternateInterface(network_state_.network_, AF_INET6);
ENVOY_LOG_EVENT(debug, "netconf_mode_switch", "AlternateBoundInterfaceMode [{}|{}]",
v4_interface, v6_interface);
}
}
}
}
Expand Down

0 comments on commit 6b6beaf

Please sign in to comment.