ntpd: In the event of route(4) overflow, update the interfaces
This commit is contained in:
parent
59e2f0df9e
commit
ddf02b2602
17
external/bsd/ntp/dist/ntpd/ntp_io.c
vendored
17
external/bsd/ntp/dist/ntpd/ntp_io.c
vendored
@ -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_reader *reader)
|
||||
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[] = {
|
||||
@ -4906,6 +4917,10 @@ init_async_notifications()
|
||||
if (setsockopt(fd, PF_ROUTE, RO_MSGFILTER,
|
||||
&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)
|
||||
|
Loading…
Reference in New Issue
Block a user