summaryrefslogtreecommitdiffstats
path: root/plugins/t
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/t')
0 files changed, 0 insertions, 0 deletions
diff --git a/plugins/check_ntp.c b/plugins/check_ntp.c
index 30e5890..1857118 100644
--- a/plugins/check_ntp.c
+++ b/plugins/check_ntp.c
@@ -507,6 +507,7 @@ double jitter_request(const char *host, int *status){
507 int peers_size=0, peer_offset=0; 507 int peers_size=0, peer_offset=0;
508 ntp_assoc_status_pair *peers=NULL; 508 ntp_assoc_status_pair *peers=NULL;
509 ntp_control_message req; 509 ntp_control_message req;
510 const char *getvar = "jitter";
510 double rval = 0.0, jitter = -1.0; 511 double rval = 0.0, jitter = -1.0;
511 char *startofvalue=NULL, *nptr=NULL; 512 char *startofvalue=NULL, *nptr=NULL;
512 void *tmp; 513 void *tmp;
@@ -584,8 +585,10 @@ double jitter_request(const char *host, int *status){
584 * thus reducing net traffic, guaranteeing us only a single 585 * thus reducing net traffic, guaranteeing us only a single
585 * datagram in reply, and making intepretation much simpler 586 * datagram in reply, and making intepretation much simpler
586 */ 587 */
587 strncpy(req.data, "jitter", 6); 588 /* Older servers doesn't know what jitter is, so if we get an
588 req.count = htons(6); 589 * error on the first pass we redo it with "dispersion" */
590 strncpy(req.data, getvar, MAX_CM_SIZE-1);
591 req.count = htons(strlen(getvar));
589 DBG(printf("sending READVAR request...\n")); 592 DBG(printf("sending READVAR request...\n"));
590 write(conn, &req, SIZEOF_NTPCM(req)); 593 write(conn, &req, SIZEOF_NTPCM(req));
591 DBG(print_ntp_control_message(&req)); 594 DBG(print_ntp_control_message(&req));
@@ -595,6 +598,14 @@ double jitter_request(const char *host, int *status){
595 read(conn, &req, SIZEOF_NTPCM(req)); 598 read(conn, &req, SIZEOF_NTPCM(req));
596 DBG(print_ntp_control_message(&req)); 599 DBG(print_ntp_control_message(&req));
597 600
601 if(req.op&REM_ERROR && strstr(getvar, "jitter")) {
602 if(verbose) printf("The 'jitter' command failed (old ntp server?)\nRestarting with 'dispersion'...\n");
603 getvar = "dispersion";
604 num_selected--;
605 i--;
606 continue;
607 }
608
598 /* get to the float value */ 609 /* get to the float value */
599 if(verbose) { 610 if(verbose) {
600 printf("parsing jitter from peer %.2x: ", ntohs(peers[i].assoc)); 611 printf("parsing jitter from peer %.2x: ", ntohs(peers[i].assoc));