Re: [chrony-users] NTP v4 header

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-users Archives ]


Am 2011-04-28 22:54, schrieb Bill Unruh:
> On Thu, 28 Apr 2011, Harald Krammer wrote:
> 
>> Hello,
>>
>> I use chrony on a embedded device. In my environment there exists many
>> different ntp implementations. Not all implementations follow the RFCs,
>> and thus I have implemented some hacks into chrony.
>>
>> e.g. force stratum on server request, take of not synchronized time
> 
> No idea what the second item is supposed to mean.

That means I ignore the check (leap == LEAP_Unsynchronised) for some
special cases.

> 
>> (Leap indicator), monitoring of chrony in case of ntp time jumps (chrony
>> may hang when time jumps are happen on ntp source -  I know these are
> 
> Chrony certainly should not hang when time jumps occur. (Why are those time
> jumps occuring in the first place?)
> What is the output into the logs when those hangs occur?
> 
> 


On time jumps an endless loop was happen in function dispatch_timeouts:
(time jumps are around 6...12 Months)


static int
dispatch_timeouts(struct timeval *now) {
  TimerQueueEntry *ptr;
  int n_done = 0;

  while ((n_timer_queue_entries > 0) &&
         (UTI_CompareTimevals(now, &(timer_queue.next->tv)) >= 0)) {
    ptr = timer_queue.next;

    /* Dispatch the handler */
    (ptr->handler)(ptr->arg);
[...]
 }
  return n_done;
}

I installed an interval timer (sched.c) to monitor the process, so the
interval time can kill chrony.

My patch looks like:

diff -u -r1.1 sched.c
--- sched.c	13 May 2009 09:43:48 -0000	1.1
+++ sched.c	20 Apr 2010 13:16:36 -0000
@@ -36,6 +36,7 @@
 #include "util.h"
 #include "local.h"
 #include "logging.h"
+#include <sys/time.h>

 /* ================================================== */

@@ -521,6 +522,8 @@

   while (!need_to_exit) {

+    SCH_SetLimit(3);
+
     /* Copy current set of read file descriptors */
     memcpy((void *) &rd, (void *) &read_fds, sizeof(fd_set));

@@ -599,3 +602,16 @@

 /* ================================================== */

+void SCH_SetLimit(int ttl) {
+
+    struct itimerval t_val;
+
+    t_val.it_interval.tv_sec = 0;
+    t_val.it_interval.tv_usec = 0;
+    t_val.it_value.tv_sec = ttl;
+    t_val.it_value.tv_usec = 0;
+
+    setitimer(ITIMER_VIRTUAL,&t_val, 0);
+}

For version 1.25 I will repeat the tests and if the problem occurs
again, then I will resolve it in a more cleaner way.


> 
>> very strange tests from my customers. )
>>
>> Right now I am fighting again with some NTP implementations. These
>> returns with NTP v4 answers  instead of ntp v3 answers. Is there
>> something to consider when I enable ntp v4 answerers in chrony. Any
>> additional risks?
>>
>> BTW I merged my few patches to 1.25-pre2 and I did not see any side
>> effects. Let me know, if I should test something.
>>
>> Nice greetings,
>> Harald
>>
>>
> 


-- 

Harald Krammer

Mobil +43.(0) 664. 130 59 58
Mail: Harald.Krammer (at) hkr.at

---
To unsubscribe email chrony-users-request@xxxxxxxxxxxxxxxxxxxx 
with "unsubscribe" in the subject.
For help email chrony-users-request@xxxxxxxxxxxxxxxxxxxx 
with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/