Limit rate of syslog messages

Error messages caused by incoming packets need to be rate limited
to avoid filling up disk space.
This commit is contained in:
Miroslav Lichvar
2010-01-13 19:02:07 +01:00
parent 5e86eeacfb
commit 032ac800aa
5 changed files with 38 additions and 15 deletions

View File

@@ -460,7 +460,7 @@ send_packet(void *packet, int packetlen, NTP_Remote_Address *remote_addr)
if (!cmsglen)
msg.msg_control = NULL;
if (sendmsg(sock_fd, &msg, 0) < 0) {
if (sendmsg(sock_fd, &msg, 0) < 0 && !LOG_RateLimited()) {
LOG(LOGS_WARN, LOGF_NtpIO, "Could not send to %s:%d : %s",
UTI_IPToString(&remote_addr->ip_addr), remote_addr->port, strerror(errno));
}