"0.0.0.0") == 0) {
if (connman_inet_set_gateway_interface(index) < 0)
return;
+ data->ipv4_gateway->active = true;
goto done;
}
"::") == 0) {
if (connman_inet_set_ipv6_gateway_interface(index) < 0)
return;
+ data->ipv6_gateway->active = true;
goto done;
}
g_strcmp0(data->ipv4_gateway->gateway,
"0.0.0.0") == 0) {
connman_inet_clear_gateway_interface(index);
+ data->ipv4_gateway->active = false;
return;
}
g_strcmp0(data->ipv6_gateway->gateway,
"::") == 0) {
connman_inet_clear_ipv6_gateway_interface(index);
+ data->ipv6_gateway->active = false;
return;
}
{
struct connman_service *service;
- service = __connman_service_get_default();
+ service = connman_service_get_default();
if (!service)
return NULL;
old_default = default_gateway;
}
#endif
- if (updated && default_gateway) {
- if (default_gateway->ipv4_gateway)
+ /*
+ * Set default gateway if it has been updated or if it has not been
+ * set as active yet.
+ */
+ if (default_gateway) {
+ if (default_gateway->ipv4_gateway &&
+ (updated || !default_gateway->ipv4_gateway->active))
set_default_gateway(default_gateway,
CONNMAN_IPCONFIG_TYPE_IPV4);
- if (default_gateway->ipv6_gateway)
+ if (default_gateway->ipv6_gateway &&
+ (updated || !default_gateway->ipv6_gateway->active))
set_default_gateway(default_gateway,
CONNMAN_IPCONFIG_TYPE_IPV6);
}