summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2010-07-12 18:56:58 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2010-07-12 20:44:32 +0200
commit645ff10be169a02870c8a0a2615c6a48b2d031d3 (patch)
tree274d2d675c22da986aa44328d72a708d79d9d0dc /src
parent57cecbcc89e3df31600b6a769be6255c5916529f (diff)
downloadconnman-645ff10be169a02870c8a0a2615c6a48b2d031d3.tar.gz
connman-645ff10be169a02870c8a0a2615c6a48b2d031d3.tar.bz2
connman-645ff10be169a02870c8a0a2615c6a48b2d031d3.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/ipconfig.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ipconfig.c b/src/ipconfig.c
index 2ef600b1..c589223c 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)