From: Samuel Ortiz Date: Mon, 12 Jul 2010 16:56:58 +0000 (+0200) Subject: Return manually set gateway when the ipdevice one is NULL X-Git-Tag: 2.0_alpha~2663 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=645ff10be169a02870c8a0a2615c6a48b2d031d3;p=framework%2Fconnectivity%2Fconnman.git Return manually set gateway when the ipdevice one is NULL 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. --- diff --git a/src/ipconfig.c b/src/ipconfig.c index 2ef600b..c589223 100644 --- a/src/ipconfig.c +++ b/src/ipconfig.c @@ -746,7 +746,14 @@ const char *__connman_ipconfig_get_gateway(int index) 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)