Re: [OpenWrt-Devel] [LEDE-DEV] [PATCH] busybox: sysntpd - Support for NTP servers received via DHCP(v6)

2016-05-20 Thread Amine Aouled Hamed
Hi,
Please add raw triggers to only the interfaces specified in the list.

Regards,
Amine.

On Fri, May 20, 2016 at 4:11 PM, Hans Dedecker  wrote:
> On Fri, May 20, 2016 at 3:59 PM, Conor O'Gorman  wrote:
>>
>>
>> On 20/05/16 14:43, Hans Dedecker wrote:
>>>
>>> On Fri, May 20, 2016 at 3:18 PM, David Lang  wrote:

 On Fri, 20 May 2016, Jo-Philipp Wich wrote:

> Hi Hans,
>
>> I wanted to preserve the ntp server behavior and only change the
>> behavior when configured in order to keep backwards compatibility. You
>> favour enabling DHCP ntp server config without explicit config ?
>
>
> Personally I do because thats likely what most users expect, but then
> trusting foreign NTP server advertisements might be a security sensitive
> topic - on the other hand one trusts the default gateway and DNS
> advertisements too, so I don't know.


 NTP isn't signed.

 If I can control your DNS, I can probably control your NTP by giving you
 the
 wrong IP for the NTP server

 If I can control your gateway, I can redirect all your NTP queries to
 someone else (NAT, redirects, etc)

 so why not trust the NTP server being provided?
>>>
>>> OK let's make the concensus to enable use_dhcp by default
>>>
>>>
>> If there are none from dhcp, it'll fall back to the configured list?
>>
>> Servers from dhcp are extra? or replacing the configured?
> Servers from DHCP are extra; thus on top of the configured ones
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] busybox: sysntpd - Support for NTP servers received via DHCP(v6)

2016-05-20 Thread Amine Aouled Hamed
Hi,
Please add raw triggers to only the interfaces specified in the list.

Regards,
Amine.

On Thu, May 19, 2016 at 6:57 PM, Hans Dedecker  wrote:
> The busybox ntpd utility currently uses ntp servers specified in uci.
> This patch allows the ntpd utility to use NTP servers received via DHCP(v6)
> Following uci parameters have been added:
> use_dhcp : enables NTP server config via DHCP(v6)
> dhcp_interface : use NTP servers received only on the specified DHCP(v6) 
> interfaces; if empty all interfaces are considered
>
> Signed-off-by: Hans Dedecker 
> ---
>
> The patch is based on a previous discussion held on the OpenWRT-devel mailing 
> list
> (https://lists.openwrt.org/pipermail/openwrt-devel/2016-January/039081.html) 
> as per Felix's
> comments this solution is based on procd interface service triggers
>
>  package/utils/busybox/Makefile  |  2 +-
>  package/utils/busybox/files/sysntpd | 43 
> -
>  2 files changed, 39 insertions(+), 6 deletions(-)
>
> diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile
> index 24c064c..24e0e11 100644
> --- a/package/utils/busybox/Makefile
> +++ b/package/utils/busybox/Makefile
> @@ -42,7 +42,7 @@ define Package/busybox
>MAINTAINER:=Felix Fietkau 
>TITLE:=Core utilities for embedded Linux
>URL:=http://busybox.net/
> -  DEPENDS:=+BUSYBOX_USE_LIBRPC:librpc +BUSYBOX_CONFIG_PAM:libpam
> +  DEPENDS:=+BUSYBOX_USE_LIBRPC:librpc +BUSYBOX_CONFIG_PAM:libpam +jsonfilter
>MENU:=1
>  endef
>
> diff --git a/package/utils/busybox/files/sysntpd 
> b/package/utils/busybox/files/sysntpd
> index f73bb83..5c663d7 100755
> --- a/package/utils/busybox/files/sysntpd
> +++ b/package/utils/busybox/files/sysntpd
> @@ -7,13 +7,35 @@ USE_PROCD=1
>  PROG=/usr/sbin/ntpd
>  HOTPLUG_SCRIPT=/usr/sbin/ntpd-hotplug
>
> +get_dhcp_ntp_servers() {
> +   local interfaces="$1"
> +   local filter="*"
> +   local network_dump interface ntpservers ntpserver
> +
> +   network_dump=$(ubus call network.interface dump)
> +   for interface in $interfaces; do
> +   [ "$filter" = "*" ] && filter="@.interface='$interface'" || 
> filter="$filter,@.interface='$interface'"
> +   done
> +
> +   ntpservers=$(jsonfilter -s "$network_dump" -e 
> "@.interface[$filter]['data']['ntpserver']")
> +
> +   for ntpserver in $ntpservers; do
> +   local duplicate=0
> +   local entry
> +   for entry in $server; do
> +   [ "$ntpserver" = "$entry" ] && duplicate=1
> +   done
> +   [ "$duplicate" = 0 ] && server="$server $ntpserver"
> +   done
> +}
> +
>  validate_ntp_section() {
> uci_validate_section system timeserver "${1}" \
> -   'server:list(host)' 'enabled:bool:1' 'enable_server:bool:0'
> +   'server:list(host)' 'enabled:bool:1' 'enable_server:bool:0' 
> 'use_dhcp:bool:0' 'dhcp_interface:list(string)'
>  }
>
>  start_service() {
> -   local server enabled enable_server peer
> +   local server enabled enable_server use_dhcp dhcp_interface peer
>
> validate_ntp_section ntp || {
> echo "validation failed"
> @@ -22,6 +44,8 @@ start_service() {
>
> [ $enabled = 0 ] && return
>
> +   [ $use_dhcp = 1 ] && get_dhcp_ntp_servers "$dhcp_interface"
> +
> [ -z "$server" ] && return
>
> procd_open_instance
> @@ -35,8 +59,17 @@ start_service() {
> procd_close_instance
>  }
>
> -service_triggers()
> -{
> -   procd_add_reload_trigger "system"
> +service_triggers() {
> +   local script name
> +
> +   script=$(readlink -f "$initscript")
> +   name=$(basename ${script:-$initscript})
> +
> +   procd_open_trigger
> +   procd_add_config_trigger "config.change" "system" /etc/init.d/$name 
> reload
> +
> +   procd_add_raw_trigger "interface.*" 2000 /etc/init.d/$name reload
> +   procd_close_trigger
> +
> procd_add_validation validate_ntp_section
>  }
> --
> 1.9.1
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] busybox: sysntpd - Support for NTP servers received via DHCP(v6)

2016-05-20 Thread Amine Aouled Hamed
Hi,
One feature that was requested is the ability to specify a list of
interfaces to get servers from.
You can save the list as an option to the config file and add a trigger to
only those interfaces.
Regards,
Amine.

On Thu, May 19, 2016 at 6:57 PM, Hans Dedecker  wrote:

> The busybox ntpd utility currently uses ntp servers specified in uci.
> This patch allows the ntpd utility to use NTP servers received via DHCP(v6)
> Following uci parameters have been added:
> use_dhcp : enables NTP server config via DHCP(v6)
> dhcp_interface : use NTP servers received only on the specified
> DHCP(v6) interfaces; if empty all interfaces are considered
>
> Signed-off-by: Hans Dedecker 
> ---
>
> The patch is based on a previous discussion held on the OpenWRT-devel
> mailing list
> (
> https://lists.openwrt.org/pipermail/openwrt-devel/2016-January/039081.html)
> as per Felix's
> comments this solution is based on procd interface service triggers
>
>  package/utils/busybox/Makefile  |  2 +-
>  package/utils/busybox/files/sysntpd | 43
> -
>  2 files changed, 39 insertions(+), 6 deletions(-)
>
> diff --git a/package/utils/busybox/Makefile
> b/package/utils/busybox/Makefile
> index 24c064c..24e0e11 100644
> --- a/package/utils/busybox/Makefile
> +++ b/package/utils/busybox/Makefile
> @@ -42,7 +42,7 @@ define Package/busybox
>MAINTAINER:=Felix Fietkau 
>TITLE:=Core utilities for embedded Linux
>URL:=http://busybox.net/
> -  DEPENDS:=+BUSYBOX_USE_LIBRPC:librpc +BUSYBOX_CONFIG_PAM:libpam
> +  DEPENDS:=+BUSYBOX_USE_LIBRPC:librpc +BUSYBOX_CONFIG_PAM:libpam
> +jsonfilter
>MENU:=1
>  endef
>
> diff --git a/package/utils/busybox/files/sysntpd
> b/package/utils/busybox/files/sysntpd
> index f73bb83..5c663d7 100755
> --- a/package/utils/busybox/files/sysntpd
> +++ b/package/utils/busybox/files/sysntpd
> @@ -7,13 +7,35 @@ USE_PROCD=1
>  PROG=/usr/sbin/ntpd
>  HOTPLUG_SCRIPT=/usr/sbin/ntpd-hotplug
>
> +get_dhcp_ntp_servers() {
> +   local interfaces="$1"
> +   local filter="*"
> +   local network_dump interface ntpservers ntpserver
> +
> +   network_dump=$(ubus call network.interface dump)
> +   for interface in $interfaces; do
> +   [ "$filter" = "*" ] && filter="@.interface='$interface'"
> || filter="$filter,@.interface='$interface'"
> +   done
> +
> +   ntpservers=$(jsonfilter -s "$network_dump" -e
> "@.interface[$filter]['data']['ntpserver']")
> +
> +   for ntpserver in $ntpservers; do
> +   local duplicate=0
> +   local entry
> +   for entry in $server; do
> +   [ "$ntpserver" = "$entry" ] && duplicate=1
> +   done
> +   [ "$duplicate" = 0 ] && server="$server $ntpserver"
> +   done
> +}
> +
>  validate_ntp_section() {
> uci_validate_section system timeserver "${1}" \
> -   'server:list(host)' 'enabled:bool:1' 'enable_server:bool:0'
> +   'server:list(host)' 'enabled:bool:1'
> 'enable_server:bool:0' 'use_dhcp:bool:0' 'dhcp_interface:list(string)'
>  }
>
>  start_service() {
> -   local server enabled enable_server peer
> +   local server enabled enable_server use_dhcp dhcp_interface peer
>
> validate_ntp_section ntp || {
> echo "validation failed"
> @@ -22,6 +44,8 @@ start_service() {
>
> [ $enabled = 0 ] && return
>
> +   [ $use_dhcp = 1 ] && get_dhcp_ntp_servers "$dhcp_interface"
> +
> [ -z "$server" ] && return
>
> procd_open_instance
> @@ -35,8 +59,17 @@ start_service() {
> procd_close_instance
>  }
>
> -service_triggers()
> -{
> -   procd_add_reload_trigger "system"
> +service_triggers() {
> +   local script name
> +
> +   script=$(readlink -f "$initscript")
> +   name=$(basename ${script:-$initscript})
> +
> +   procd_open_trigger
> +   procd_add_config_trigger "config.change" "system"
> /etc/init.d/$name reload
> +
> +   procd_add_raw_trigger "interface.*" 2000 /etc/init.d/$name reload
> +   procd_close_trigger
> +
> procd_add_validation validate_ntp_section
>  }
> --
> 1.9.1
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [LEDE-DEV] [PATCH] busybox: sysntpd - Support for NTP servers received via DHCP(v6)

2016-05-20 Thread Amine Aouled Hamed
Hi,
One feature that was requested is the ability to specify a list of
interfaces to get servers from.
You can save the list as an option to the config file and add a trigger to
only those interfaces.
Regards,
Amine.

On Fri, May 20, 2016 at 11:01 AM, Jo-Philipp Wich  wrote:

> Hi Hans,
>
> > I wanted to preserve the ntp server behavior and only change the
> > behavior when configured in order to keep backwards compatibility. You
> > favour enabling DHCP ntp server config without explicit config ?
>
> Personally I do because thats likely what most users expect, but then
> trusting foreign NTP server advertisements might be a security sensitive
> topic - on the other hand one trusts the default gateway and DNS
> advertisements too, so I don't know.
>
>
> > Regarding the improvements do you want me to send a patch containing
> > the diff with the already staged commit or do you prefer a v2 patch ?
>
> Whatever you prefer - I think a v2 is the easiest and I can just replace
> the commit in my tree.
>
> ~ Jo
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>



-- 

Amine Hamed | Software Engineer



Ocedo GmbH | Hirschstrasse 7 | 76133 Karlsruhe | Germany

Email aha...@ocedo.com




REGISTERED OFFICE: KARLSRUHE | DISTRICT COURT: MANNHEIM | REGISTER NUMBER:
HRB 717873
MANAGING DIRECTOR: MARKUS HENNIG|JAN HICHERT
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] Add support for multiple RADIUS servers

2016-04-21 Thread Amine Aouled Hamed
My bad, will send a new patch.

On Wed, Apr 20, 2016 at 8:21 PM, John Crispin  wrote:

>
>
> On 20/04/2016 20:09, Rafał Miłecki wrote:
> > On 20 April 2016 at 16:48, amine.ahd  wrote:
> >> Hostapd allows more than one RADIUS server to be added in case the main
> server goes down.
> >> This allows netifd to load a list of RADIUS servers from the wireless
> confid file and add them to hostapd.
> >> The format of the list in the config file is as follow:
> >> list auth_servers ...
> >> list auth_ports ...
> >> list auth_secrets ...
> >
> > You need to sign off your patch with a real name.
> > ___
>
> and the subject is missing the prefix, in this case "hostapd"
>



-- 

Amine Hamed | Software Engineer



Ocedo GmbH | Hirschstrasse 7 | 76133 Karlsruhe | Germany

Email aha...@ocedo.com




REGISTERED OFFICE: KARLSRUHE | DISTRICT COURT: MANNHEIM | REGISTER NUMBER:
HRB 717873
MANAGING DIRECTOR: MARKUS HENNIG|JAN HICHERT
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Procd: Weird behaviour when adding multiple triggers

2016-02-04 Thread Amine Aouled Hamed
Can anyone confirm this issue so I could try and find a fix for it?
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] memory leak in procd

2016-02-01 Thread Amine Aouled Hamed
So did the patch fix the problem and is it going to be added to the
official procd repo?



On Thu, Jan 28, 2016 at 5:32 PM, Felix Fietkau  wrote:

> On 2016-01-28 15:39, Kenneth Johansson wrote:
> > when using rpcd and updating config files using the ubus interface there
> > is a memory leak in procd.
> >
> > here is a script that shows the error.
> >
> >
> > 
> > #!/bin/sh
> >
> > touch /etc/config/playapp
> >
> > while true
> > do
> >  ubus call uci add '{"config":"playapp","type":"blabla"}'
> >  ubus call uci commit '{"config":"playapp"}'
> >  ps | grep procd|grep -v grep
> > done
> > 
> >
> > the issue happens in libubusbox function json_script_get_file() that
> > recreates a new json_script_file all the time.
> >
> > json_script_get_file() end up calling rule_load_script() in procd
> > (system/trigger.c) and that do the allocation.
> > then json_script_get_file adds it to a avl tree.
> >
> > but its done over and over every call.
> >
> > not sure what the solution is here. where is the deallocation supposed
> > to happen?
> Please try this patch: http://nbd.name/procd-trigger.patch
>
> Thanks,
>
> - Felix
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>



-- 

Amine Hamed | Software Engineer



Ocedo GmbH | Hirschstrasse 7 | 76133 Karlsruhe | Germany

Email aha...@ocedo.com




REGISTERED OFFICE: KARLSRUHE | DISTRICT COURT: MANNHEIM | REGISTER NUMBER:
HRB 717873
MANAGING DIRECTOR: MARKUS HENNIG|JAN HICHERT
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] Procd: Weird behaviour when adding multiple triggers

2016-01-29 Thread Amine Aouled Hamed
Hi,
When adding an interface trigger to sysntpd, the trigger won't work when
another trigger is present(in this case a reload trigger for system).
below is the service_triggers function I used for sysntpd:

service_triggers()
{
local script=$(readlink "$initscript")
local name=$(basename ${script:-$initscript})

procd_open_trigger
procd_add_raw_trigger "interface.*" 2000 /etc/init.d/$name reload
procd_close_trigger

procd_add_reload_trigger "system"
procd_add_validation validate_ntp_section
}

For testing I added a logger msg in start_service and tested by restarting
the network service or unplugging a cable(once with system reload trigger
and another without).

Can anyone confirm this behaviour and explain if it is intended?
Thanks.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Procd: Weird behaviour when adding multiple triggers

2016-01-29 Thread Amine Aouled Hamed
cat /etc/banner:
Bleeding Edge, r48488

On Fri, Jan 29, 2016 at 11:18 AM, Amine Aouled Hamed <amine@gmail.com>
wrote:

>
> Hi,
> When adding an interface trigger to sysntpd, the trigger won't work when
> another trigger is present(in this case a reload trigger for system).
> below is the service_triggers function I used for sysntpd:
>
> service_triggers()
> {
> local script=$(readlink "$initscript")
> local name=$(basename ${script:-$initscript})
>
> procd_open_trigger
> procd_add_raw_trigger "interface.*" 2000 /etc/init.d/$name reload
> procd_close_trigger
>
> procd_add_reload_trigger "system"
> procd_add_validation validate_ntp_section
> }
>
> For testing I added a logger msg in start_service and tested by restarting
> the network service or unplugging a cable(once with system reload trigger
> and another without).
>
> Can anyone confirm this behaviour and explain if it is intended?
> Thanks.
>



-- 

Amine Hamed | Software Engineer



Ocedo GmbH | Hirschstrasse 7 | 76133 Karlsruhe | Germany

Email aha...@ocedo.com


<aha...@ocedo.com>

REGISTERED OFFICE: KARLSRUHE | DISTRICT COURT: MANNHEIM | REGISTER NUMBER:
HRB 717873
MANAGING DIRECTOR: MARKUS HENNIG|JAN HICHERT
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] busybox: sysntpd - use NTP servers received via DHCP

2016-01-26 Thread Amine Aouled Hamed
Anyone tried both triggers at the same time and checked if it works
correctly?

On Mon, Jan 25, 2016 at 5:05 PM, Amine Aouled Hamed <amine@gmail.com>
wrote:

> this is the patch:
> ---
>  package/utils/busybox/files/sysntpd | 8 
>  1 file changed, 8 insertions(+)
>
> diff --git a/package/utils/busybox/files/sysntpd
> b/package/utils/busybox/files/sysntpd
> index f73bb83..2e7a47d 100755
> --- a/package/utils/busybox/files/sysntpd
> +++ b/package/utils/busybox/files/sysntpd
> @@ -15,6 +15,7 @@ validate_ntp_section() {
>  start_service() {
> local server enabled enable_server peer
>
> +   logger -t sysntpd "starting ntpds"
> validate_ntp_section ntp || {
> echo "validation failed"
> return 1
> @@ -37,6 +38,13 @@ start_service() {
>
>  service_triggers()
>  {
> +   local script=$(readlink "$initscript")
> +   local name=$(basename ${script:-$initscript})
> +
> +   procd_open_trigger
> +   procd_add_raw_trigger "interface.*" 2000 /etc/init.d/$name reload
> +   procd_close_trigger
> +
> procd_add_reload_trigger "system"
> procd_add_validation validate_ntp_section
>  }
>
> What I found is that commenting out the system reload trigger will make
> the interface trigger work. Maybe a bug when adding multiple triggers?
>
> On Mon, Jan 25, 2016 at 3:14 PM, Bastian Bittorf <bitt...@bluebottle.com>
> wrote:
>
>> * Amine Aouled Hamed <amine@gmail.com> [25.01.2016 14:53]:
>> > So using the latest procd version,
>> > I added a simple logger message on top start_service() in sysntpd and
>> added
>> > the triggers in service_triggers and to test I just unplugged and
>> > re-plugget my network cable and checked logread.
>> > Nothing shows up.
>>
>> not every switchport is aware of un- or replug.
>> better wait for DHCP-lease timeout to check if it triggers.
>> (or do 'ifup lan')
>>
>> bye, bastian
>>
>
>
>
> --
>
> Amine Hamed | Software Engineer
>
>
>
> Ocedo GmbH | Hirschstrasse 7 | 76133 Karlsruhe | Germany
>
> Email aha...@ocedo.com
>
>
> <aha...@ocedo.com>
>
> REGISTERED OFFICE: KARLSRUHE | DISTRICT COURT: MANNHEIM | REGISTER NUMBER:
> HRB 717873
> MANAGING DIRECTOR: MARKUS HENNIG|JAN HICHERT
>



-- 

Amine Hamed | Software Engineer



Ocedo GmbH | Hirschstrasse 7 | 76133 Karlsruhe | Germany

Email aha...@ocedo.com


<aha...@ocedo.com>

REGISTERED OFFICE: KARLSRUHE | DISTRICT COURT: MANNHEIM | REGISTER NUMBER:
HRB 717873
MANAGING DIRECTOR: MARKUS HENNIG|JAN HICHERT
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] busybox: sysntpd - use NTP servers received via DHCP

2016-01-25 Thread Amine Aouled Hamed
So using the latest procd version,
I added a simple logger message on top start_service() in sysntpd and added
the triggers in service_triggers and to test I just unplugged and
re-plugget my network cable and checked logread.
Nothing shows up.

On Mon, Jan 25, 2016 at 10:26 AM, Amine Aouled Hamed <amine@gmail.com>
wrote:

> Hi Felix,
> Actually I made my tests on an old version of OpenWrt, maybe procd changed
> since that version.
> Will make another tests using the current version and let you know of the
> results.
>
> On Fri, Jan 22, 2016 at 2:39 PM, Felix Fietkau <n...@openwrt.org> wrote:
>
>> On 2016-01-22 14:12, Amine Aouled Hamed wrote:
>> > Hi,
>> > I tried this method the first time but it does nothing.
>> > I just tried it again now and the same thing happens (added a log
>> > message to logread in case it is restarted).
>> > Thats why I went to the hotplug script, add to it the fact that we cant
>> > choose specific interfaces to listen to using this method.
>> You can also choose specific interfaces via triggers, I just wrote the
>> simple variant that catches all changes. Please show me the exact patch
>> that you tried, so I can check it to see if I can spot the bug.
>>
>> - Felix
>>
>
>
>
> --
>
> Amine Hamed | Software Engineer
>
>
>
> Ocedo GmbH | Hirschstrasse 7 | 76133 Karlsruhe | Germany
>
> Email aha...@ocedo.com
>
>
> <aha...@ocedo.com>
>
> REGISTERED OFFICE: KARLSRUHE | DISTRICT COURT: MANNHEIM | REGISTER NUMBER:
> HRB 717873
> MANAGING DIRECTOR: MARKUS HENNIG|JAN HICHERT
>



-- 

Amine Hamed | Software Engineer



Ocedo GmbH | Hirschstrasse 7 | 76133 Karlsruhe | Germany

Email aha...@ocedo.com


<aha...@ocedo.com>

REGISTERED OFFICE: KARLSRUHE | DISTRICT COURT: MANNHEIM | REGISTER NUMBER:
HRB 717873
MANAGING DIRECTOR: MARKUS HENNIG|JAN HICHERT
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] busybox: sysntpd - use NTP servers received via DHCP

2016-01-25 Thread Amine Aouled Hamed
this is the patch:
---
 package/utils/busybox/files/sysntpd | 8 
 1 file changed, 8 insertions(+)

diff --git a/package/utils/busybox/files/sysntpd
b/package/utils/busybox/files/sysntpd
index f73bb83..2e7a47d 100755
--- a/package/utils/busybox/files/sysntpd
+++ b/package/utils/busybox/files/sysntpd
@@ -15,6 +15,7 @@ validate_ntp_section() {
 start_service() {
local server enabled enable_server peer

+   logger -t sysntpd "starting ntpds"
validate_ntp_section ntp || {
echo "validation failed"
return 1
@@ -37,6 +38,13 @@ start_service() {

 service_triggers()
 {
+   local script=$(readlink "$initscript")
+   local name=$(basename ${script:-$initscript})
+
+   procd_open_trigger
+   procd_add_raw_trigger "interface.*" 2000 /etc/init.d/$name reload
+   procd_close_trigger
+
procd_add_reload_trigger "system"
procd_add_validation validate_ntp_section
 }

What I found is that commenting out the system reload trigger will make the
interface trigger work. Maybe a bug when adding multiple triggers?

On Mon, Jan 25, 2016 at 3:14 PM, Bastian Bittorf <bitt...@bluebottle.com>
wrote:

> * Amine Aouled Hamed <amine@gmail.com> [25.01.2016 14:53]:
> > So using the latest procd version,
> > I added a simple logger message on top start_service() in sysntpd and
> added
> > the triggers in service_triggers and to test I just unplugged and
> > re-plugget my network cable and checked logread.
> > Nothing shows up.
>
> not every switchport is aware of un- or replug.
> better wait for DHCP-lease timeout to check if it triggers.
> (or do 'ifup lan')
>
> bye, bastian
>



-- 

Amine Hamed | Software Engineer



Ocedo GmbH | Hirschstrasse 7 | 76133 Karlsruhe | Germany

Email aha...@ocedo.com


<aha...@ocedo.com>

REGISTERED OFFICE: KARLSRUHE | DISTRICT COURT: MANNHEIM | REGISTER NUMBER:
HRB 717873
MANAGING DIRECTOR: MARKUS HENNIG|JAN HICHERT
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] busybox: ntpd - Add support for NTP servers received from DHCP

2016-01-25 Thread Amine Aouled Hamed
My bad, could this be deleted please? Thanks

On Mon, Jan 25, 2016 at 5:03 PM, amine ahd  wrote:

> ---
>  package/utils/busybox/files/sysntpd | 8 
>  1 file changed, 8 insertions(+)
>
> diff --git a/package/utils/busybox/files/sysntpd
> b/package/utils/busybox/files/sysntpd
> index f73bb83..2e7a47d 100755
> --- a/package/utils/busybox/files/sysntpd
> +++ b/package/utils/busybox/files/sysntpd
> @@ -15,6 +15,7 @@ validate_ntp_section() {
>  start_service() {
> local server enabled enable_server peer
>
> +   logger -t sysntpd "starting ntpds"
> validate_ntp_section ntp || {
> echo "validation failed"
> return 1
> @@ -37,6 +38,13 @@ start_service() {
>
>  service_triggers()
>  {
> +   local script=$(readlink "$initscript")
> +   local name=$(basename ${script:-$initscript})
> +
> +   procd_open_trigger
> +   procd_add_raw_trigger "interface.*" 2000 /etc/init.d/$name reload
> +   procd_close_trigger
> +
> procd_add_reload_trigger "system"
> procd_add_validation validate_ntp_section
>  }
> --
> 2.5.0
>
>


-- 

Amine Hamed | Software Engineer



Ocedo GmbH | Hirschstrasse 7 | 76133 Karlsruhe | Germany

Email aha...@ocedo.com




REGISTERED OFFICE: KARLSRUHE | DISTRICT COURT: MANNHEIM | REGISTER NUMBER:
HRB 717873
MANAGING DIRECTOR: MARKUS HENNIG|JAN HICHERT
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] busybox: sysntpd - use NTP servers received via DHCP

2016-01-25 Thread Amine Aouled Hamed
Hi Felix,
Actually I made my tests on an old version of OpenWrt, maybe procd changed
since that version.
Will make another tests using the current version and let you know of the
results.

On Fri, Jan 22, 2016 at 2:39 PM, Felix Fietkau <n...@openwrt.org> wrote:

> On 2016-01-22 14:12, Amine Aouled Hamed wrote:
> > Hi,
> > I tried this method the first time but it does nothing.
> > I just tried it again now and the same thing happens (added a log
> > message to logread in case it is restarted).
> > Thats why I went to the hotplug script, add to it the fact that we cant
> > choose specific interfaces to listen to using this method.
> You can also choose specific interfaces via triggers, I just wrote the
> simple variant that catches all changes. Please show me the exact patch
> that you tried, so I can check it to see if I can spot the bug.
>
> - Felix
>



-- 

Amine Hamed | Software Engineer



Ocedo GmbH | Hirschstrasse 7 | 76133 Karlsruhe | Germany

Email aha...@ocedo.com


<aha...@ocedo.com>

REGISTERED OFFICE: KARLSRUHE | DISTRICT COURT: MANNHEIM | REGISTER NUMBER:
HRB 717873
MANAGING DIRECTOR: MARKUS HENNIG|JAN HICHERT
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] busybox: sysntpd - use NTP servers received via DHCP

2016-01-22 Thread Amine Aouled Hamed
Hi,
I tried this method the first time but it does nothing.
I just tried it again now and the same thing happens (added a log message
to logread in case it is restarted).
Thats why I went to the hotplug script, add to it the fact that we cant
choose specific interfaces to listen to using this method.


On Wed, Jan 20, 2016 at 1:51 PM, Felix Fietkau  wrote:

> On 2016-01-20 13:34, amine ahd wrote:
> > The current state of NTP is to load the list of NTP servers
> > from the static file /etc/config/system.
> > This patch allows ntpd to get NTP servers from DHCP.
> >
> >
> > Changes from V1:
> >   -Users could choose not to use DHCP by setting "use_dhcp" to 0 in
> /etc/config/system under the ntp section.
> >   -Users could specify which interfaces to use to get NTP servers
> from.
> >   -Sysntpd will exit if no servers are specified in the static list
> and the DHCP option is disabled.
> >   -Sysntpd will restart only if all of the following conditions are
> met:
> >   *The user allowed DHCP to be used for NTP.
> >   *The iface action is UP.
> >   *The iface is specified in the list.
> >   *The protocol in use is either DHCP or DHCPv6.
> >   -Code improvements.
> >
> > Signed-off-by: amine hamed 
> > ---
> >  package/utils/busybox/Makefile  |  3 ++
> >  package/utils/busybox/files/sysntpd | 31 +++--
> >  package/utils/busybox/files/sysntpd.hotplug | 54
> +
> >  3 files changed, 85 insertions(+), 3 deletions(-)
> >  create mode 100644 package/utils/busybox/files/sysntpd.hotplug
> >
> > diff --git a/package/utils/busybox/files/sysntpd.hotplug
> b/package/utils/busybox/files/sysntpd.hotplug
> > new file mode 100644
> > index 000..34a2f7a
> > --- /dev/null
> > +++ b/package/utils/busybox/files/sysntpd.hotplug
> > @@ -0,0 +1,54 @@
> > +#!/bin/sh
> > +
> > +. /lib/functions.sh
> > +. /usr/share/libubox/jshn.sh
> > +
> > +is_valid_interface() {
> > + local list="$(uci get system.ntp.dhcp_ifaces)"
> > + [ -z "$list" ] && return 0
> > +
> > + case " $list " in
> > + *" $INTERFACE "*)
> > + return 0
> > + ;;
> > + *)
> > + return 1
> > + ;;
> > + esac
> > +}
> > +
> > +config_load system
> > +local proto="$(uci get network.$INTERFACE.proto)"
> > +config_get_bool "use_dhcp" "ntp" "use_dhcp"
> > +[ "$use_dhcp" = 1 ] && [ "$ACTION" = ifup ] && is_valid_interface && [
> "$proto" = dhcp -o "$proto" = dhcp6 ] || exit 0
> > +
> > +handle_default_ntp_servers() {
> > + local server="$1"
> > + new_ntp_servers="$new_ntp_servers $server"
> > +}
> > +
> > +local dhcp_ntp_servers iface status ntpserver dump
> > +local dhcp_ifaces="$(uci -q get system.ntp.dhcp_ifaces)"
> > +if [ -z "$dhcp_ifaces" ]; then
> > + dump="$(ubus call network.interface dump)"
> > + dhcp_ntp_servers=$(jsonfilter -s "$dump" -e
> '$["interface"][*]["data"]["ntpserver"]')
> > +else
> > + for iface in $dhcp_ifaces; do
> > + status="$(ubus call network.interface.$iface status)"
> > + ntpserver=$(jsonfilter -s "$status" -e
> '$["data"]["ntpserver"]')
> > + [ -n "$ntpserver" ] && \
> > + dhcp_ntp_servers="$dhcp_ntp_servers $ntpserver"
> > + done
> > +fi
> > +
> > +new_ntp_servers="$dhcp_ntp_servers"
> > +#get the default list of ntp servers from the config file and append it
> to the new list
> > +config_list_foreach "ntp" "server" handle_default_ntp_servers
> > +
> > +#get the current list of ntp servers in the running instance
> > +local current_ntp_servers=$(ubus call service list '{"name":"sysntpd",
> "verbose":true}' | jsonfilter -e
> '$["sysntpd"]["instances"][*]["data"]["ntp_servers"]')
> > +#if its an up action, the iface uses DHCP and the new list of ntp
> servers is different from the old, restart sysntpd
> > +[ "$current_ntp_servers" != "$new_ntp_servers" ] || exit 0
> > +
> > +logger -t sysntpd "Reloading sysntpd due to $ACTION of interface
> $INTERFACE and a change of NTP servers"
> > +/etc/init.d/sysntpd enabled && /etc/init.d/sysntpd reload
> This is all way more complex than it needs to be. There's a simple
> solution -
> just replace the sysntpd init script service_triggers function with this:
>
> service_triggers() {
> local script=$(readlink "$initscript")
> local name=$(basename ${script:-$initscript})
>
> procd_open_trigger
> procd_add_raw_trigger "interface.*" 2000 /etc/init.d/$name reload
> procd_close_trigger
>
> procd_add_reload_trigger "system"
> procd_add_validation validate_ntp_section
> }
>
> You can drop the hotplug script entirely.
> What this will do is it will instruct procd to run the init script,
> whenever an interface up/down event arrives (waiting for up to 2 seconds
> before starting the script instead of starting it once 

Re: [OpenWrt-Devel] [PATCH] use NTP server received via DHCP

2016-01-20 Thread Amine Aouled Hamed
Ah sorry, I thought he meant the description of the patch.
Will change it now

On Wed, Jan 20, 2016 at 10:14 AM, Bastian Bittorf 
wrote:

> * amine ahd  [20.01.2016 10:09]:
>
> thank you!
>
> > The current state of NTP is to load the list of NTP servers
> > from the static file /etc/config/system.
> > This patch allows ntpd to get NTP servers from DHCP.
>
> like john wrote already:
> if you edit the first line of the commit-message, please write:
>
> busybox: ntp - use server received via DHCP
>
> the rest looks good to me. - bye, bastian
>



-- 

Amine Hamed | Software Engineer



Ocedo GmbH | Hirschstrasse 7 | 76133 Karlsruhe | Germany

Email aha...@ocedo.com




REGISTERED OFFICE: KARLSRUHE | DISTRICT COURT: MANNHEIM | REGISTER NUMBER:
HRB 717873
MANAGING DIRECTOR: MARKUS HENNIG|JAN HICHERT
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 1/1] use NTP server received via DHCP

2016-01-15 Thread Amine Aouled Hamed
>
> please make var 'iface' local and while you are there, move
> all the 'local' declaration to the head of the function.

Wouldn't be better if the local vars inside of the if and for statements
stay inside?
I mean what is the point of declaring ifaces if I will be using all the
ifaces? in term of performance(even if it is negligible and clarity of the
code).

Thanks for following the patch!
Regards,
Amine

On Thu, Jan 14, 2016 at 10:44 AM, Bastian Bittorf 
wrote:

> * amine ahd  [14.01.2016 10:29]:
>
> thank you, patch applies...
>
> >  start_service() {
> > - local server enabled enable_server peer
> > + local server enabled enable_server peer ntpservers
> > + local use_dhcp="$(uci -q get system.ntp.use_dhcp)"
> >
> >   validate_ntp_section ntp || {
> >   echo "validation failed"
> > @@ -21,13 +25,33 @@ start_service() {
> >   }
> >
> >   [ $enabled = 0 ] && return
> > -
> > - [ -z "$server" ] && return
> > + [ -z "$server" ] && [ "$use_dhcp" = 0 ] && return
>
> i'am ok with this, if you like you can reuse
> 'config_get_bool()' from /lib/functions.sh
>
> >   procd_open_instance
> >   procd_set_param command "$PROG" -n
> >   [ "$enable_server" = "1" ] && procd_append_param command -l
> >   [ -x "$HOTPLUG_SCRIPT" ] && procd_append_param command -S
> "$HOTPLUG_SCRIPT"
> > +
> > + local dhcp_ifaces="$(uci -q get system.ntp.dhcp_ifaces)"
> > + [ "$use_dhcp" = 1 ] && {
>
> this should also be 'bool'
>
> > + if [ -z "$dhcp_ifaces" ]; then
> > + local dump="$(ubus call network.interface dump)"
> > + ntpservers=$(jsonfilter -s "$dump" -e
> '$["interface"][*]["data"]["ntpserver"]')
> > + else
> > + for iface in $dhcp_ifaces; do
>
> please make var 'iface' local and while you are there, move
> all the 'local' declaration to the head of the function.
>
> the rest looks OK to me. - thank you
>
> bye, bastian
>



-- 

Amine Hamed | Software Engineer



Ocedo GmbH | Hirschstrasse 7 | 76133 Karlsruhe | Germany

Email aha...@ocedo.com




REGISTERED OFFICE: KARLSRUHE | DISTRICT COURT: MANNHEIM | REGISTER NUMBER:
HRB 717873
MANAGING DIRECTOR: MARKUS HENNIG|JAN HICHERT
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 1/1] use NTP server received via DHCP

2016-01-13 Thread Amine Aouled Hamed
Apologies, I was working with an old fork of Openwrt.
another version (hopefully the last) will be sent soon.

Regards,
Amine.

On Tue, Jan 12, 2016 at 10:20 AM, Bastian Bittorf 
wrote:

> * amine ahd  [12.01.2016 10:08]:
> > ---
> >  package/utils/busybox/Makefile |  3 ++
> >  package/utils/busybox/files/sysntpd| 26 ++-
> >  package/utils/busybox/files/sysntpd.hotplug| 53
> ++
> >  3 files changed, 80 insertions(+), 2 deletions(-)
> >  create mode 100755 package/utils/busybox/files/sysntpd.hotplug
>
> also it does not apply:
>
> bastian@X301:~/software/openwrt$ curl -s
> https://patchwork.ozlabs.org/patch/566411/mbox/ | git apply --check
> error: patch failed: package/utils/busybox/Makefile:112
> error: package/utils/busybox/Makefile: patch does not apply
>
> bye, bastian
>



-- 

Amine Hamed | Software Engineer



Ocedo GmbH | Hirschstrasse 7 | 76133 Karlsruhe | Germany

Email aha...@ocedo.com




REGISTERED OFFICE: KARLSRUHE | DISTRICT COURT: MANNHEIM | REGISTER NUMBER:
HRB 717873
MANAGING DIRECTOR: MARKUS HENNIG|JAN HICHERT
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 1/1] [DEV-1329] use NTP server received via DHCP

2016-01-07 Thread Amine Aouled Hamed
On Thu, Jan 7, 2016 at 2:42 PM, Bastian Bittorf 
wrote:

> when looking at the present code, it
> returns when the static list is empty.
>
> maybe it's a rare condition, but your code
> changes the behavior. for now ignore this
> and polish the rest, lets see what the others say.
>
> bye, bastian
>

AFAIK, this was the default behaviour. I removed it because IMO it is not
the case anymore to exit when we have an empty static list.
If this needs to be changed, please let me know.

Regards,
Amine.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] use NTP server received via DHCP

2016-01-05 Thread Amine Aouled Hamed
Happy new year!
Thanks for the explanation, I will be sending a new patch today.
Regards,
Amine.

On Wed, Dec 30, 2015 at 2:14 PM, Yousong Zhou <yszhou4t...@gmail.com> wrote:

> Hi,
>
> On 30 December 2015 at 20:12, Amine Aouled Hamed <amine@gmail.com>
> wrote:
> >
> > Hi,
> > Can you elaborate more on why you prefer uci state? I am just starting
> with OpenWRT and the first thing I found was procd.
> >
>
> Most of it is really just personal preference.  I prefer uci because
> it can provide more structured access/manipulation of the state, e.g.
>
>  - disable those ntpservers on interface down
>  - when it comes to ntpservers from multiple dhcp interfaces
>  - the state can be easily checked with uci command if something went wrong
>
> These can of course also be done with procd data, but uci is already
> there...
>
> Regards,
> yousong
>



-- 

Amine Hamed | Software Engineer



Ocedo GmbH | Hirschstrasse 7 | 76133 Karlsruhe | Germany

Email aha...@ocedo.com


<aha...@ocedo.com>

REGISTERED OFFICE: KARLSRUHE | DISTRICT COURT: MANNHEIM | REGISTER NUMBER:
HRB 717873
MANAGING DIRECTOR: MARKUS HENNIG|JAN HICHERT
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] use NTP server received via DHCP

2015-12-30 Thread Amine Aouled Hamed
Hi,
Can you elaborate more on why you prefer uci state? I am just starting with
OpenWRT and the first thing I found was procd.

Regards,
Amine.

On Thu, Dec 24, 2015 at 2:35 PM, Yousong Zhou  wrote:

> Hi, amine
>
> On 23 December 2015 at 00:00, amine ahd  wrote:
> > The current state of NTP is to load the list of NTP servers
> > from the static file /etc/config/system.
> > This patch allows ntpd to get NTP servers from DHCP.
> > ntpd will restart whenever the list of NTP servers is changed.
> >
> > Signed-off-by: amine hamed 
> > ---
> >  package/utils/busybox/Makefile |  3 +++
> >  package/utils/busybox/files/sysntpd| 15 +--
> >  .../package/utils/busybox/files/sysntpd.hotplug| 31
> ++
> >  3 files changed, 47 insertions(+), 2 deletions(-)
> >  create mode 100755 package/utils/busybox/files/sysntpd.hotplug
> >
> > diff --git a/package/utils/busybox/Makefile
> b/package/utils/busybox/Makefile
> > index 9571d48..3c33246 100644
> > --- a/package/utils/busybox/Makefile
> > +++ b/package/utils/busybox/Makefile
> > @@ -112,6 +112,9 @@ define Package/busybox/install
> > $(INSTALL_BIN) ./files/cron $(1)/etc/init.d/cron
> > $(INSTALL_BIN) ./files/telnet $(1)/etc/init.d/telnet
> > $(INSTALL_BIN) ./files/sysntpd $(1)/etc/init.d/sysntpd
> > +   $(INSTALL_DIR) $(1)/etc/hotplug.d
> > +   $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
> > +   $(INSTALL_BIN) ./files/sysntpd.hotplug
> $(1)/etc/hotplug.d/iface/30-sysntpd
> > $(INSTALL_BIN) ./files/ntpd-hotplug $(1)/usr/sbin/ntpd-hotplug
> > -rm -rf $(1)/lib64
> >  endef
> > diff --git a/package/utils/busybox/files/sysntpd
> b/package/utils/busybox/files/sysntpd
> > index f73bb83..fbe1838 100755
> > --- a/package/utils/busybox/files/sysntpd
> > +++ b/package/utils/busybox/files/sysntpd
> > @@ -1,12 +1,12 @@
> >  #!/bin/sh /etc/rc.common
> >  # Copyright (C) 2011 OpenWrt.org
> >
> > +. /lib/functions.sh
> >  START=98
> >
> >  USE_PROCD=1
> >  PROG=/usr/sbin/ntpd
> >  HOTPLUG_SCRIPT=/usr/sbin/ntpd-hotplug
> > -
> >  validate_ntp_section() {
> > uci_validate_section system timeserver "${1}" \
> > 'server:list(host)' 'enabled:bool:1'
> 'enable_server:bool:0'
> > @@ -15,6 +15,8 @@ validate_ntp_section() {
> >  start_service() {
> > local server enabled enable_server peer
> >
> > +   #get the list of ntp servers from DHCP using ubus.
> > +   ntpservers=`ubus call network.interface dump | grep "ntpserver"
> | cut -d":" -f2 | tr -d '"'`
>
> This can be done with help from jsonfilter
>
> ubus call network.interface dump | jsonfilter -e
> '$["interface"][*]["data"]["ntpserver"]'
>
> It should also be possible for users to specify sources of timeserver
> settings, whether it be static list of servers in uci configs or dhcp
> settings from some network interfaces.
>
> > validate_ntp_section ntp || {
> > echo "validation failed"
> > return 1
> > @@ -22,12 +24,20 @@ start_service() {
> >
> > [ $enabled = 0 ] && return
> >
> > -   [ -z "$server" ] && return
> > +   [ -z "$server" ] && [ "$ntpservers" == "" ] && return
> >
> > procd_open_instance
> > procd_set_param command "$PROG" -n
> > [ "$enable_server" = "1" ] && procd_append_param command -l
> > [ -x "$HOTPLUG_SCRIPT" ] && procd_append_param command -S
> "$HOTPLUG_SCRIPT"
> > +
> > +   #add this data so we can use it in the sysntpd hotplug script.
> > +   procd_set_param data ntp_servers="$ntpservers $server"
> > +
>
> Not quite sure about this, but are we going to replace uci_set_state
> with procd data param?  Personally I prefer uci state for such
> "dynamic" data store
>
> Regards,
>
> yousong
>
> > +   for ntpserver in $ntpservers; do
> > +   procd_append_param command -p $ntpserver
> > +   done
> > +
> > for peer in $server; do
> > procd_append_param command -p $peer
> > done
> > @@ -38,5 +48,6 @@ start_service() {
> >  service_triggers()
> >  {
> > procd_add_reload_trigger "system"
> > +
> > procd_add_validation validate_ntp_section
> >  }
> > diff --git a/package/utils/busybox/files/sysntpd.hotplug
> b/package/utils/busybox/files/sysntpd.hotplug
> > new file mode 100755
> > index 000..de2946a
> > --- /dev/null
> > +++ b/package/utils/busybox/files/sysntpd.hotplug
> > @@ -0,0 +1,31 @@
> > +#!/bin/sh
> > +
> > +. /lib/functions.sh
> > +
> > +[ "$ACTION" = ifup ] || exit 0
> > +
> > +handle_default_ntp_servers() {
> > +   local server="$1"
> > +   # append the server to the list
> > +   new_ntp_servers="$new_ntp_servers $server"
> > +}
> > +
> > +local proto=`uci get network.$INTERFACE.proto`
> > +
> > +#get the list of ntp servers returned from DHCP, remote leading and
> trailing whitespaces as well as string quotes
> >