On 04/04/2012 11:29 AM, alok barsode wrote:
hi Jukka,
On Wed, Apr 4, 2012 at 11:09 AM, Jukka Rissanen
<[email protected] <mailto:[email protected]>>
wrote:
Hi Alok,
On 04/03/2012 11:50 PM, Alok Barsode wrote:
From: Alok Barsode<alok.barsode@linux.__intel.com
<mailto:[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 | 33 ++++++++++++++++++++++++++++--__---
1 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/src/timeserver.c b/src/timeserver.c
index 308355f..b81129a 100644
--- a/src/timeserver.c
+++ b/src/timeserver.c
@@ -35,6 +35,7 @@
static GSList *ts_list = NULL;
static char **service_ts = NULL;
+static const char *service_gw = NULL;
This is unnecessary initialization, static is NULL anyway. As the
other variables around it have done initialization so perhaps this
is not worth fixing.
Actually, do we need to remember service_gw because the
__connman_timeserver_sync() will fetch it anyway if service is not NULL?
we need to cache it , to reconstruct the server list when we dont have
the service pointer. For example when the global timeservers are
modified, we call __connman_timeserver_sync(NULL). In case like this we
dont have the service pointer to get the gw.
How can we be sure that service_gw still points to valid memory?
If the ipconfig of the service is changed the system_gw could become a
stale pointer. So either we should fetch the used gw every time the sync
is done or we should allocate (and deallocate) the system_gw somewhere
and not just take a pointer that might disappear.
Cheers,
Jukka
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman