Module Name: src
Committed By: roy
Date: Fri Jan 1 17:21:47 UTC 2021
Modified Files:
src/external/bsd/ntp/dist/ntpd: ntp_io.c
Log Message:
ntpd: In the event of route(4) overflow, update the interfaces
To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/external/bsd/ntp/dist/ntpd/ntp_io.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/bsd/ntp/dist/ntpd/ntp_io.c
diff -u src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.27 src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.28
--- src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.27 Mon May 25 20:47:25 2020
+++ src/external/bsd/ntp/dist/ntpd/ntp_io.c Fri Jan 1 17:21:47 2021
@@ -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 @@ process_routing_msgs(struct asyncio_read
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 @@ init_async_notifications()
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 @@ init_async_notifications()
&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);