]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Be more graceful about reporting home server state
authorAlan T. DeKok <aland@freeradius.org>
Mon, 7 Jan 2013 23:43:51 +0000 (18:43 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 7 Jan 2013 23:44:52 +0000 (18:44 -0500)
src/main/command.c

index 5f8d2e4e9f58baee189f34f14092b5715ae1e9f3..3fefc7f7a5223eb473ea70868ca199eb5b56b24e 100644 (file)
@@ -642,7 +642,24 @@ static int command_show_home_servers(rad_listen_t *listener, UNUSED int argc, UN
                        state = "dead";
 
                } else if (home->state == HOME_STATE_UNKNOWN) {
-                       state = "unknown";
+                       time_t now = time(NULL);
+
+                       /*
+                        *      We've recently received a packet, so
+                        *      the home server seems to be alive.
+                        *
+                        *      The *reported* state changes because
+                        *      the internal state machine NEEDS THE
+                        *      RIGHT STATE.  However, reporting that
+                        *      to the admin will confuse him.  So...
+                        *      we lie.  Yes, that dress doesn't make
+                        *      you look fat.
+                        */
+                       if ((home->last_packet_recv + home->ping_interval) >= now) {
+                               state = "alive";
+                       } else {
+                               state = "unknown";
+                       }
 
                } else continue;