Module Name: src Committed By: msaitoh Date: Tue Sep 9 08:24:29 UTC 2014
Modified Files: src/usr.sbin/ypbind [netbsd-6]: ypbind.8 ypbind.c Log Message: Pull up following revision(s) (requested by dholland in ticket #1083): usr.sbin/ypbind/ypbind.c: revision 1.91 usr.sbin/ypbind/ypbind.c: revision 1.92 usr.sbin/ypbind/ypbind.c: revision 1.93 usr.sbin/ypbind/ypbind.c: revision 1.94 usr.sbin/ypbind/ypbind.c: revision 1.95 usr.sbin/ypbind/ypbind.c: revision 1.96 usr.sbin/ypbind/ypbind.c: revision 1.97 usr.sbin/ypbind/ypbind.c: revision 1.98 usr.sbin/ypbind/ypbind.8: revision 1.20 usr.sbin/ypbind/ypbind.8: revision 1.19 Don't store the default domain name in a global. While running we really don't care which domain is the system's default domain. Factor out some rpc validation code. While there are times it's appropriate to call a state variable "evil", this isn't one of them. Since the logic involved is to wait until the default domain binds before backgrounding, call the variable "started" instead. Don't rake up the default domain until after processing arguments. Processing arguments just sets flags -- may as well do it first, and this way detection of silly errors isn't contingent on having things fully configured and operating. Load up with comments. Instead of using magic numbers in what looks like a boolean (dom_alive), create a state enumeration (domainstates) and use it instead. Instead of three states (new, alive, and, effectively, 'troubled') go to five: new, alive, pinging, lost, and dead. Domains start in the NEW state. When we get a reply from a server, the state goes to ALIVE. The state is set to PINGING when we ping the server (once a minute normally) and if the ping times out, it goes to LOST. If we stay lost for a minute, go to DEAD, and in DEAD, do exponential backoff of nag_servers calls. Getting rid of the broken logic attached to the 'troubled' state fixes PR 15355 (ypbind defeats disk idle spindown) -- it will now only rewrite the binding file when the binding changes. Also, fix the HEURISTIC code so it doesn't trigger except in ALIVE state. I think this was the source of a lot of the spamming behavior seen in PR 32519, which is now fixed. Might also fix PR 23135 (broadcast ypbind sometimes fails to find servers). Add a SIGHUP handler; upon SIGHUP do an extra nag_servers on any domain that's in DEAD state. This lets you explicitly rescue ypbind from its exponential backoff when you know the world's back up. Log state transitions. Don't store the default domain name in a global. While running we really don't care which domain is the system's default domain. Factor out some rpc validation code. While there are times it's appropriate to call a state variable "evil", this isn't one of them. Since the logic involved is to wait until the default domain binds before backgrounding, call the variable "started" instead. Don't rake up the default domain until after processing arguments. Processing arguments just sets flags -- may as well do it first, and this way detection of silly errors isn't contingent on having things fully configured and operating. Load up with comments. Instead of using magic numbers in what looks like a boolean (dom_alive), create a state enumeration (domainstates) and use it instead. Instead of three states (new, alive, and, effectively, 'troubled') go to five: new, alive, pinging, lost, and dead. Domains start in the NEW state. When we get a reply from a server, the state goes to ALIVE. The state is set to PINGING when we ping the server (once a minute normally) and if the ping times out, it goes to LOST. If we stay lost for a minute, go to DEAD, and in DEAD, do exponential backoff of nag_servers calls. Getting rid of the broken logic attached to the 'troubled' state fixes PR 15355 (ypbind defeats disk idle spindown) -- it will now only rewrite the binding file when the binding changes. Also, fix the HEURISTIC code so it doesn't trigger except in ALIVE state. I think this was the source of a lot of the spamming behavior seen in PR 32519, which is now fixed. Might also fix PR 23135 (broadcast ypbind sometimes fails to find servers). Add a SIGHUP handler; upon SIGHUP do an extra nag_servers on any domain that's in DEAD state. This lets you explicitly rescue ypbind from its exponential backoff when you know the world's back up. Log state transitions. Document exponential backoff behavior and SIGHUP support, plus a couple other minor edits. Use more markup. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.18.22.1 src/usr.sbin/ypbind/ypbind.8 cvs rdiff -u -r1.90 -r1.90.4.1 src/usr.sbin/ypbind/ypbind.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.