diff options
author | markm <markm@FreeBSD.org> | 2010-10-08 20:17:17 +0000 |
---|---|---|
committer | markm <markm@FreeBSD.org> | 2010-10-08 20:17:17 +0000 |
commit | f3d9dd1ac925b5458c89e66763a526ca72dc601c (patch) | |
tree | 4020471525097df4698605dab661083e89f905f6 /usr.sbin/ypbind | |
parent | 15c0e64e316e88eccfd4a9cf566d7e360eef1e46 (diff) | |
download | FreeBSD-src-f3d9dd1ac925b5458c89e66763a526ca72dc601c.zip FreeBSD-src-f3d9dd1ac925b5458c89e66763a526ca72dc601c.tar.gz |
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.
Diffstat (limited to 'usr.sbin/ypbind')
-rw-r--r-- | usr.sbin/ypbind/ypbind.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/usr.sbin/ypbind/ypbind.c b/usr.sbin/ypbind/ypbind.c index a3a7dc3..0083cf8 100644 --- a/usr.sbin/ypbind/ypbind.c +++ b/usr.sbin/ypbind/ypbind.c @@ -116,6 +116,9 @@ int ypsetmode = YPSET_NO; int ypsecuremode = 0; int ppid; +#define NOT_RESPONDING_HYSTERESIS 10 +static int not_responding_count = 0; + /* * Special restricted mode variables: when in restricted mode, only the * specified restricted_domain will be bound, and only the servers listed @@ -654,9 +657,13 @@ broadcast(struct _dom_binding *ypdb) return; } - 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", - inet_ntoa(ypdb->dom_server_addr.sin_addr), ypdb->dom_domain); + if (ypdb->dom_vers == -1 && (long)ypdb->dom_server_addr.sin_addr.s_addr) { + if (not_responding_count++ >= NOT_RESPONDING_HYSTERESIS) { + 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; 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. */ - if (ypdb->dom_vers == -1 && ypdb->dom_server_addr.sin_addr.s_addr) - syslog(LOG_WARNING, "NIS server [%s] for domain \"%s\" OK", - inet_ntoa(raddrp->sin_addr), ypdb->dom_domain); + if (ypdb->dom_vers == -1 && ypdb->dom_server_addr.sin_addr.s_addr) { + if (not_responding_count >= NOT_RESPONDING_HYSTERESIS) { + 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, sizeof ypdb->dom_server_addr); |