|
Loading...
|
connman@connman.net
[Prev] Thread [Next] | [Prev] Date [Next]
[PATCH v6 06/14] timeserver: Add service gateway to timeserver list Alok Barsode Thu Apr 05 04:00:31 2012
From: Alok Barsode <[EMAIL PROTECTED]>
Add default service Gateway to the timeserver query list.
Now the list is service timeservers(via DHCP), gateway and global
timeservers, in that order.
---
src/timeserver.c | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/src/timeserver.c b/src/timeserver.c
index cfa4a82..9202df8 100644
--- a/src/timeserver.c
+++ b/src/timeserver.c
@@ -161,15 +161,17 @@ void __connman_timeserver_sync_next()
* __connman_timeserver_sync function recreates the timeserver
* list which will be used to determine NTP server for time corrections.
* It must be called everytime the default service changes, the service
- * timeserver(s) changes or the global timeserver(s) changes.The service
- * settings take priority over the global timeservers.
+ * timeserver(s) or gatway changes or the global timeserver(s) changes.
+ * The service settings take priority over the global timeservers.
*/
int __connman_timeserver_sync(struct connman_service *default_service)
{
struct connman_service *service;
+ struct connman_network *network;
char **timeservers;
char **service_ts;
- int i;
+ const char *service_gw;
+ int index, i;
if (default_service != NULL)
service = default_service;
@@ -198,9 +200,21 @@ int __connman_timeserver_sync(struct connman_service
*default_service)
service_ts = connman_service_get_timeservers(service);
+ /* First add Service Timeservers via DHCP to the list */
for (i=0; service_ts != NULL && service_ts[i] != NULL; i++)
ts_list = g_slist_prepend(ts_list, g_strdup(service_ts[i]));
+ network = __connman_service_get_network(service);
+
+ index = connman_network_get_index(network);
+
+ service_gw = __connman_ipconfig_get_gateway_from_index(index);
+
+ /* Then add Service Gateway to the list */
+ if (service_gw != NULL)
+ ts_list = g_slist_prepend(ts_list, g_strdup(service_gw));
+
+ /* Then add Global Timeservers to the list */
timeservers = load_timeservers();
for (i=0; timeservers != NULL && timeservers[i] != NULL; i++)
--
1.7.5.4
_______________________________________________
connman mailing list
[EMAIL PROTECTED]
http://lists.connman.net/listinfo/connman
- [PATCH v6 00/14] NTP Overhaul Alok Barsode 2012/04/05
- [PATCH v6 01/14] meego: Remove the meego plugin Alok Barsode 2012/04/05
- [PATCH v6 02/14] Replace older system timeserver values with new ones instead of appending Alok Barsode 2012/04/05
- [PATCH v6 03/14] service: Add __connman_service_get_default Alok Barsode 2012/04/05
- [PATCH v6 04/14] timeserver: Trigger ntp on default changed notifier Alok Barsode 2012/04/05
- [PATCH v6 05/14] timeserver: Create timeserver list Alok Barsode 2012/04/05
- [PATCH v6 06/14] timeserver: Add service gateway to timeserver list Alok Barsode 2012/04/05 <=
- [PATCH v6 07/14] service: Add Timeservers.Configuration Property Alok Barsode 2012/04/05
- [PATCH v6 08/14] timeserver: Add Timeservers.Configuration to timeserver list Alok Barsode 2012/04/05
- [PATCH v6 09/14] doc: Add Timeserves.Configuration service property Alok Barsode 2012/04/05
- [PATCH v6 10/14] test: Add set-timeservers Alok Barsode 2012/04/05
- Re: [PATCH v6 10/14] test: Add set-timeservers Jeff Zheng 2012/04/05
- [PATCH v6 11/14] ntp: Shorten NTP failure delay Alok Barsode 2012/04/05
- [PATCH v6 12/14] main: Parse FallbackTimeservers list from main.conf Alok Barsode 2012/04/05
- [PATCH v6 13/14] timeservers: Add Fallback Timerservers Alok Barsode 2012/04/05
- [PATCH v6 14/14] timeserver: Check for resolv before accessing it Alok Barsode 2012/04/05
- Re: [PATCH v6 00/14] NTP Overhaul Patrik Flykt 2012/04/05