With N (> 1) online services, only the connected device will have its
gateway set (as the default route). If the remaining ones have manually set
gateways, then let's return that.
if (ipdevice == NULL)
return NULL;
- return ipdevice->gateway;
+ if (ipdevice->gateway != NULL)
+ return ipdevice->gateway;
+
+ if (ipdevice->config != NULL &&
+ ipdevice->config->address != NULL)
+ return ipdevice->config->address->gateway;
+
+ return NULL;
}
void __connman_ipconfig_set_index(struct connman_ipconfig *ipconfig, int index)