Browse Source

decrease logging a bit

OPENBSD_6_5
Brent Cook 5 years ago
parent
commit
52060b10f4
2 changed files with 11 additions and 10 deletions
  1. +8
    -7
      patches/0014-use-adjtimex-over-adjtime-check-return-value-and-adj.patch
  2. +3
    -3
      patches/0015-increase-buffer-sizes-potential-truncation.patch

+ 8
- 7
patches/0014-use-adjtimex-over-adjtime-check-return-value-and-adj.patch View File

@ -1,15 +1,15 @@
From fcf1d2a424913003fd28db171925858e043162aa Mon Sep 17 00:00:00 2001
From 26d528a642433031e14580cad0db841b6f60897d Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Sat, 19 Jan 2019 04:25:44 -0600
Subject: [PATCH 14/15] use adjtimex over adjtime, check return value and
adjust offset as needed
---
src/usr.sbin/ntpd/ntpd.c | 31 ++++++++++++++++++++++++++++---
1 file changed, 28 insertions(+), 3 deletions(-)
src/usr.sbin/ntpd/ntpd.c | 32 +++++++++++++++++++++++++++++---
1 file changed, 29 insertions(+), 3 deletions(-)
diff --git a/src/usr.sbin/ntpd/ntpd.c b/src/usr.sbin/ntpd/ntpd.c
index c3b7ab07e1..ddb2ee87d6 100644
index c3b7ab07e1..8d4bffa3e3 100644
--- a/src/usr.sbin/ntpd/ntpd.c
+++ b/src/usr.sbin/ntpd/ntpd.c
@@ -17,6 +17,9 @@
@ -22,7 +22,7 @@ index c3b7ab07e1..ddb2ee87d6 100644
#include <sys/types.h>
#include <sys/resource.h>
#include <sys/socket.h>
@@ -478,21 +481,43 @@ reset_adjtime(void)
@@ -478,21 +481,44 @@ reset_adjtime(void)
int
ntpd_adjtime(double d)
{
@ -45,14 +45,15 @@ index c3b7ab07e1..ddb2ee87d6 100644
+ long offset = d * 1000000;
+ struct timex tx = { 0 };
+ tx.offset = offset;
+ tx.modes = ADJ_OFFSET_SINGLESHOT;
+ tx.modes = ADJ_OFFSET_SINGLESHOT | ADJ_STATUS;
+
+ do {
+ rc = adjtimex(&tx);
+ } while (rc == TIME_ERROR && (tx.offset /= 2) > threshold);
+
+ if (rc == TIME_ERROR) {
+ log_warn("adjtimex returned TIME_ERROR");
+ if ((tx.status & ~STA_UNSYNC))
+ log_warn("adjtimex returned TIME_ERROR");
+ } else if (rc < 0) {
+ log_warn("adjtimex failed");
+ } else if (!firstadj && tx.offset == offset) {


+ 3
- 3
patches/0015-increase-buffer-sizes-potential-truncation.patch View File

@ -1,4 +1,4 @@
From 48ef737a92b3f427d76b9e5c7803f72012c583ee Mon Sep 17 00:00:00 2001
From 2c93917c251e941b7caa2e874051634f8da00814 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Sat, 13 Apr 2019 04:45:22 -0500
Subject: [PATCH 15/15] increase buffer sizes potential truncation
@ -9,10 +9,10 @@ Subject: [PATCH 15/15] increase buffer sizes potential truncation
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/usr.sbin/ntpd/ntpd.c b/src/usr.sbin/ntpd/ntpd.c
index ddb2ee87d6..e98f322086 100644
index 8d4bffa3e3..ded54fa65e 100644
--- a/src/usr.sbin/ntpd/ntpd.c
+++ b/src/usr.sbin/ntpd/ntpd.c
@@ -872,7 +872,7 @@ show_peer_msg(struct imsg *imsg, int calledfromshowall)
@@ -873,7 +873,7 @@ show_peer_msg(struct imsg *imsg, int calledfromshowall)
{
struct ctl_show_peer *cpeer;
int cnt;


Loading…
Cancel
Save