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 ntpd: In the event of route(4) ov...



details:   https://anonhg.NetBSD.org/src/rev/8ea40710dc57
branches:  trunk
changeset: 958347:8ea40710dc57
user:      roy <roy%NetBSD.org@localhost>
date:      Fri Jan 01 17:21:47 2021 +0000

description:
ntpd: In the event of route(4) overflow, update the interfaces

diffstat:

 external/bsd/ntp/dist/ntpd/ntp_io.c |  17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diffs (45 lines):

diff -r 1222d2db7534 -r 8ea40710dc57 external/bsd/ntp/dist/ntpd/ntp_io.c
--- a/external/bsd/ntp/dist/ntpd/ntp_io.c       Fri Jan 01 16:50:47 2021 +0000
+++ b/external/bsd/ntp/dist/ntpd/ntp_io.c       Fri Jan 01 17:21:47 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ntp_io.c,v 1.27 2020/05/25 20:47:25 christos Exp $     */
+/*     $NetBSD: ntp_io.c,v 1.28 2021/01/01 17:21:47 roy Exp $  */
 
 /*
  * ntp_io.c - input/output routines for ntpd.  The socket-opening code
@@ -4727,6 +4727,14 @@
                if (errno == ENOBUFS) {
                        msyslog(LOG_ERR,
                                "routing socket reports: %m");
+                       /*
+                        * drain the routing socket as we need to update
+                        * the interfaces anyway
+                        */
+                       do {
+                               cnt = read(reader->fd, buffer, sizeof(buffer));
+                       } while (cnt != -1 || errno == ENOBUFS);
+                       timer_interfacetimeout(current_time + UPDATE_GRACE);
                } else {
                        msyslog(LOG_ERR,
                                "routing socket reports: %m - disabling");
@@ -4837,6 +4845,9 @@
        struct sockaddr_nl sa;
 #else
        int fd = socket(PF_ROUTE, SOCK_RAW, 0);
+#ifdef SO_RERROR
+       int on = 1;
+#endif
 #endif
 #ifdef RO_MSGFILTER
        unsigned char msgfilter[] = {
@@ -4907,6 +4918,10 @@
            &msgfilter, sizeof(msgfilter)) == -1)
                msyslog(LOG_ERR, "RO_MSGFILTER: %m");
 #endif
+#ifdef SO_RERROR
+       if (setsockopt(fd, SOL_SOCKET, SO_RERROR, &on, sizeof(on)) == -1)
+               msyslog(LOG_ERR, "SO_RERROR: %m");
+#endif
        make_socket_nonblocking(fd);
 #if defined(HAVE_SIGNALED_IO)
        init_socket_sig(fd);



Home | Main Index | Thread Index | Old Index