Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/ntp/dist/ntpd ntp: respect user's wishes to dis...



details:   https://anonhg.NetBSD.org/src/rev/1c3ecd2eba2e
branches:  trunk
changeset: 958390:1c3ecd2eba2e
user:      roy <roy%NetBSD.org@localhost>
date:      Sun Jan 03 15:33:05 2021 +0000

description:
ntp: respect user's wishes to disable interface scanning

While here, disable periodic scanning by default on NetBSD as it's
no longer needed.
The user can still enable it though with a positive number to the -U
option.

kardel@ So far I see no other issues from the pitfalls I know of

diffstat:

 external/bsd/ntp/dist/ntpd/cmd_args.c  |   8 +++++---
 external/bsd/ntp/dist/ntpd/ntp_io.c    |   7 ++++++-
 external/bsd/ntp/dist/ntpd/ntp_timer.c |  10 ++++++----
 3 files changed, 17 insertions(+), 8 deletions(-)

diffs (70 lines):

diff -r 81ff49e87fde -r 1c3ecd2eba2e external/bsd/ntp/dist/ntpd/cmd_args.c
--- a/external/bsd/ntp/dist/ntpd/cmd_args.c     Sun Jan 03 10:31:37 2021 +0000
+++ b/external/bsd/ntp/dist/ntpd/cmd_args.c     Sun Jan 03 15:33:05 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cmd_args.c,v 1.6 2020/05/25 20:47:25 christos Exp $    */
+/*     $NetBSD: cmd_args.c,v 1.7 2021/01/03 15:33:05 roy Exp $ */
 
 /*
  * cmd_args.c = command-line argument processing
@@ -181,9 +181,11 @@
        if (HAVE_OPT( UPDATEINTERVAL )) {
                long val = OPT_VALUE_UPDATEINTERVAL;
 
-               if (val >= 0)
+               if (val >= 0) {
                        interface_interval = val;
-               else {
+                       if (interface_interval == 0)
+                               disable_dynamic_updates = 1;
+               } else {
                        fprintf(stderr,
                                "command line interface update interval %ld must not be negative\n",
                                val);
diff -r 81ff49e87fde -r 1c3ecd2eba2e external/bsd/ntp/dist/ntpd/ntp_io.c
--- a/external/bsd/ntp/dist/ntpd/ntp_io.c       Sun Jan 03 10:31:37 2021 +0000
+++ b/external/bsd/ntp/dist/ntpd/ntp_io.c       Sun Jan 03 15:33:05 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ntp_io.c,v 1.28 2021/01/01 17:21:47 roy Exp $  */
+/*     $NetBSD: ntp_io.c,v 1.29 2021/01/03 15:33:05 roy Exp $  */
 
 /*
  * ntp_io.c - input/output routines for ntpd.  The socket-opening code
@@ -455,8 +455,13 @@
 {
        /* Init buffer free list and stat counters */
        init_recvbuff(RECV_INIT);
+#ifdef SO_RERROR
+       /* route(4) overflow can be observed */
+       interface_interval = 0;
+#else
        /* update interface every 5 minutes as default */
        interface_interval = 300;
+#endif
 
 #ifdef WORK_PIPE
        addremove_io_fd = &ntpd_addremove_io_fd;
diff -r 81ff49e87fde -r 1c3ecd2eba2e external/bsd/ntp/dist/ntpd/ntp_timer.c
--- a/external/bsd/ntp/dist/ntpd/ntp_timer.c    Sun Jan 03 10:31:37 2021 +0000
+++ b/external/bsd/ntp/dist/ntpd/ntp_timer.c    Sun Jan 03 15:33:05 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ntp_timer.c,v 1.8 2020/05/25 20:47:25 christos Exp $   */
+/*     $NetBSD: ntp_timer.c,v 1.9 2021/01/03 15:33:05 roy Exp $        */
 
 /*
  * ntp_timer.c - event timer support routines
@@ -423,9 +423,11 @@
        /*
         * Interface update timer
         */
-       if (interface_interval && interface_timer <= current_time) {
-               timer_interfacetimeout(current_time +
-                   interface_interval);
+       if (!disable_dynamic_updates &&
+           interface_timer && interface_timer <= current_time) {
+               if (interface_interval)
+                       timer_interfacetimeout(current_time +
+                           interface_interval);
                DPRINTF(2, ("timer: interface update\n"));
                interface_update(NULL, NULL);
        }



Home | Main Index | Thread Index | Old Index