Don't let the "available"/"not available" logs flap quite so badly. In the

case of a multi-interfaced host, sub-second flapping can fill up the logs
too quickly. This fixes that.
This commit is contained in:
Mark Murray 2010-10-08 20:17:17 +00:00
parent b602c58edf
commit 471f9e3e00
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=213611

View File

@ -116,6 +116,9 @@ int ypsetmode = YPSET_NO;
int ypsecuremode = 0; int ypsecuremode = 0;
int ppid; int ppid;
#define NOT_RESPONDING_HYSTERESIS 10
static int not_responding_count = 0;
/* /*
* Special restricted mode variables: when in restricted mode, only the * Special restricted mode variables: when in restricted mode, only the
* specified restricted_domain will be bound, and only the servers listed * specified restricted_domain will be bound, and only the servers listed
@ -654,9 +657,13 @@ broadcast(struct _dom_binding *ypdb)
return; return;
} }
if (ypdb->dom_vers == -1 && (long)ypdb->dom_server_addr.sin_addr.s_addr) if (ypdb->dom_vers == -1 && (long)ypdb->dom_server_addr.sin_addr.s_addr) {
syslog(LOG_WARNING, "NIS server [%s] for domain \"%s\" not responding", if (not_responding_count++ >= NOT_RESPONDING_HYSTERESIS) {
inet_ntoa(ypdb->dom_server_addr.sin_addr), ypdb->dom_domain); not_responding_count = NOT_RESPONDING_HYSTERESIS;
syslog(LOG_WARNING, "NIS server [%s] for domain \"%s\" not responding",
inet_ntoa(ypdb->dom_server_addr.sin_addr), ypdb->dom_domain);
}
}
broad_domain = ypdb; broad_domain = ypdb;
flock(ypdb->dom_lockfd, LOCK_UN); flock(ypdb->dom_lockfd, LOCK_UN);
@ -886,9 +893,13 @@ rpc_received(char *dom, struct sockaddr_in *raddrp, int force)
} }
/* We've recovered from a crash: inform the world. */ /* We've recovered from a crash: inform the world. */
if (ypdb->dom_vers == -1 && ypdb->dom_server_addr.sin_addr.s_addr) if (ypdb->dom_vers == -1 && ypdb->dom_server_addr.sin_addr.s_addr) {
syslog(LOG_WARNING, "NIS server [%s] for domain \"%s\" OK", if (not_responding_count >= NOT_RESPONDING_HYSTERESIS) {
inet_ntoa(raddrp->sin_addr), ypdb->dom_domain); not_responding_count = 0;
syslog(LOG_WARNING, "NIS server [%s] for domain \"%s\" OK",
inet_ntoa(raddrp->sin_addr), ypdb->dom_domain);
}
}
bcopy(raddrp, &ypdb->dom_server_addr, bcopy(raddrp, &ypdb->dom_server_addr,
sizeof ypdb->dom_server_addr); sizeof ypdb->dom_server_addr);