[PATCH] ntpd: simplify peer configuration

2010-10-05 Thread Davide Cavalca
Hello everybody,

please find attached a patch to simplify the ntpd plugin peer
configuration code; this patch is necessary to make the plugin
compatibile with busybox implementation of ntpd, which does not 
support a configuration file.

Best regards,
Davide Cavalca
From e392831631f55ce7a7ff2898b26ff6d81c4c0e41 Mon Sep 17 00:00:00 2001
From: Davide Cavalca dav...@geexbox.org
Date: Tue, 5 Oct 2010 11:24:04 +0200
Subject: [PATCH] ntpd: simplify peer configuration

---
 plugins/ntpd.c |   36 ++--
 1 files changed, 2 insertions(+), 34 deletions(-)

diff --git a/plugins/ntpd.c b/plugins/ntpd.c
index 731fa46..3d9a572 100644
--- a/plugins/ntpd.c
+++ b/plugins/ntpd.c
@@ -120,23 +120,6 @@ static void ntpdate_died(struct connman_task *task, void *user_data)
 	connman_task_destroy(ntpdate-task);
 }
 
-static void ntpdate_add_peer(struct ntpdate_task *ntpdate, char *peer)
-{
-	FILE *conf_file;
-
-	DBG(%s, peer);
-
-	conf_file = fdopen(ntpdate-conf_fd, a+);
-	if (conf_file == NULL) {
-		connman_error(fdopen failed);
-		return;
-	}
-
-	fprintf(conf_file, server %s iburst\n, peer);
-
-	fclose(conf_file);
-}
-
 static int ntpdate(void)
 {
 	int err;
@@ -161,33 +144,18 @@ static int ntpdate(void)
 	connman_task_add_argument(ntpdate-task, -g, NULL);
 	connman_task_add_argument(ntpdate-task, -q, NULL);
 
-	/* The servers are added through a temp configuration file */
-	ntpdate-conf_fd = g_file_open_tmp(connman.ntp.conf_XX,
-		ntpdate-conf_path, g_err);
-	if  (ntpdate-conf_fd == -1) {
-		err = g_err-code;
-		g_free(g_err);
-		goto error_open;
-	}
-
-	connman_task_add_argument(ntpdate-task, -c, ntpdate-conf_path);
-
-	DBG(conf path %s, ntpdate-conf_path);
-
 	for (list = pending_peers; list; list = list-next) {
 		peer = list-data;
 
-		ntpdate_add_peer(ntpdate, peer-server);
+		connman_task_add_argument(ntpdate-task, -p, peer-server);
 	}
 
 	for (list = peers; list; list = list-next) {
 		peer = list-data;
 
-		ntpdate_add_peer(ntpdate, peer-server);
+		connman_task_add_argument(ntpdate-task, -p, peer-server);
 	}
 
-	close(ntpdate-conf_fd);
-
 	return connman_task_run(ntpdate-task, ntpdate_died, ntpdate,
 		NULL, NULL, NULL);
 error_open:
-- 
1.7.1

___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman

Re: [PATCH Adding proxy settings 1/4] Service API documentation updated to include Proxy settings updates.

2010-10-05 Thread Tomasz Bursztyka

Hi

On 05/10/10 12:41, ext Marcel Holtmann wrote:

Means that a simple entry like [ server:901 ] would be the generic one
and [ http://server:901;, ftp://server:109; ] could identify different
servers.
   

That seems fine, let's do that way.

Best regards,

Tomasz
___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


Re: [PATCH Adding proxy settings 1/4] Service API documentation updated to include Proxy settings updates.

2010-10-05 Thread Marcel Holtmann
Hi Tomasz,

  Means that a simple entry like [ server:901 ] would be the generic one
  and [ http://server:901;, ftp://server:109; ] could identify different
  servers.
 
 That seems fine, let's do that way.

please update your documentation patch and start working on the
implementation. I think just storing it in src/service.c like we do for
domains and nameservers should be good enough. Since essentially ConnMan
is not doing anything with these values at all. So no need to involve
any IP internal here.

Also please update PACrunner to accept the same Servers property with
the manual method. And of course the pacrunner plugin to send these
values.

Regards

Marcel


___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


Re: [PATCH] ntpd: simplify peer configuration

2010-10-05 Thread Samuel Ortiz
Hi Davide,

On Tue, Oct 05, 2010 at 11:59:02AM +0200, Davide Cavalca wrote:
 Hello everybody,
 
 please find attached a patch to simplify the ntpd plugin peer
 configuration code; this patch is necessary to make the plugin
 compatibile with busybox implementation of ntpd, which does not 
 support a configuration file.
Unfortunately, busybox's ntpd -p option is not compatible with the ntp.org
ntpd ones, which is the daemon most distributions ship.
So your patch will break it. I'd suggest implementing a busybox ntpd plugin.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/
___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


Re: [PATCH] ntpd: simplify peer configuration

2010-10-05 Thread Samuel Ortiz
On Tue, Oct 05, 2010 at 04:41:56PM +0200, Marcel Holtmann wrote:
 Hi Samuel,
 
   please find attached a patch to simplify the ntpd plugin peer
   configuration code; this patch is necessary to make the plugin
   compatibile with busybox implementation of ntpd, which does not 
   support a configuration file.
  Unfortunately, busybox's ntpd -p option is not compatible with the ntp.org
  ntpd ones, which is the daemon most distributions ship.
  So your patch will break it. I'd suggest implementing a busybox ntpd plugin.
 
 or just fixing busybox to be compatible with upstream ntpd.
Right, adding a -c option to busybox ntpd would work in our case.
In a perfect world we would have our tiny ntp client implementation, as the
only thing we're trying to do is to send a time query once and setting the
time from the reply.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/
___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman