Commit 6c365d45 authored by Jussi Laakkonen's avatar Jussi Laakkonen

connection: Set and unset active flag when changing default gateway

The active flag for gateway should be set also when it is set or unset
as default gateway as it is done with VPN gateways. The active flag is
used in finding the active gateway (find_active_gateway(), choosing the
default gateway (choose_default_gateway()), updating the default gateway
(__connman_connection_update_gateway()) and to delete routes
(disable_gateway()).

The active flag is set/unset when adding or removing the gateway but not
touched when updating the interface using set_default_gateway() and
unset_default_gateway(). This adds setting of the flag in both of the
uses of the set/unset default gateway and unset_default_gateway(). This
adds setting of the flag in both of the uses of the set/unset default
gateway.

[connman] Set/unset active flag if changing gw. Contributes to JB#42017
parent 2c624d7f
......@@ -476,6 +476,7 @@ static void set_default_gateway(struct gateway_data *data,
"0.0.0.0") == 0) {
if (connman_inet_set_gateway_interface(index) < 0)
return;
data->ipv4_gateway->active = true;
goto done;
}
......@@ -484,6 +485,7 @@ static void set_default_gateway(struct gateway_data *data,
"::") == 0) {
if (connman_inet_set_ipv6_gateway_interface(index) < 0)
return;
data->ipv6_gateway->active = true;
goto done;
}
......@@ -550,6 +552,7 @@ static void unset_default_gateway(struct gateway_data *data,
g_strcmp0(data->ipv4_gateway->gateway,
"0.0.0.0") == 0) {
connman_inet_clear_gateway_interface(index);
data->ipv4_gateway->active = false;
return;
}
......@@ -557,6 +560,7 @@ static void unset_default_gateway(struct gateway_data *data,
g_strcmp0(data->ipv6_gateway->gateway,
"::") == 0) {
connman_inet_clear_ipv6_gateway_interface(index);
data->ipv6_gateway->active = false;
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment