diff mbox

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

Message ID CAMXA6B0Ad30OX1igrivhQxFRmxRmMEm7ETOtgMqUByDWJgp3Nw@mail.gmail.com
State RFC
Headers show

Commit Message

amine ahd Jan. 25, 2016, 4:05 p.m. UTC
this is the patch:
---
 package/utils/busybox/files/sysntpd | 8 ++++++++
 1 file changed, 8 insertions(+)


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 <bittorf@bluebottle.com>
wrote:

> * Amine Aouled Hamed <amine.ahd@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
>

Comments

amine ahd Jan. 26, 2016, 1:34 p.m. UTC | #1
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.ahd@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 <bittorf@bluebottle.com>
> wrote:
>
>> * Amine Aouled Hamed <amine.ahd@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 ahamed@ocedo.com
>
>
> <ahamed@ocedo.com>
>
> REGISTERED OFFICE: KARLSRUHE | DISTRICT COURT: MANNHEIM | REGISTER NUMBER:
> HRB 717873
> MANAGING DIRECTOR: MARKUS HENNIG|JAN HICHERT
>
diff mbox

Patch

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
 }