1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00

use first gateway, not last...

This commit is contained in:
Thomas Winget 2022-10-19 22:29:09 -04:00
parent 011bd2e84f
commit 0c0ba29bae

View file

@ -147,13 +147,16 @@ namespace llarp
auto& route = platform->RouteManager();
// find current gateways
// get current gateways, assume sorted by lowest metric first
auto gateways = route.GetGatewaysNotOnInterface(*vpn);
std::optional<net::ipv4addr_t> next_gw;
for (auto& gateway : gateways)
{
if (auto* gw_ptr = std::get_if<net::ipv4addr_t>(&gateway))
{
next_gw = *gw_ptr;
break;
}
}
// update current gateway and apply state changes as needed