summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--conf/conf.c5
-rw-r--r--conf/conf.h3
-rw-r--r--doc/reply_codes2
-rw-r--r--nest/cmds.c17
4 files changed, 25 insertions, 2 deletions
diff --git a/conf/conf.c b/conf/conf.c
index 21413e5..a4e0363 100644
--- a/conf/conf.c
+++ b/conf/conf.c
@@ -18,6 +18,7 @@
#include "lib/resource.h"
#include "lib/string.h"
#include "lib/event.h"
+#include "lib/timer.h"
#include "conf/conf.h"
#include "filter/filter.h"
@@ -26,6 +27,7 @@ static jmp_buf conf_jmpbuf;
struct config *config, *new_config, *old_config, *future_config;
static event *config_event;
int shutting_down;
+bird_clock_t boot_time;
struct config *
config_alloc(byte *name)
@@ -37,6 +39,9 @@ config_alloc(byte *name)
c->pool = p;
cfg_mem = c->mem = l;
c->file_name = cfg_strdup(name);
+ c->load_time = now;
+ if (!boot_time)
+ boot_time = now;
return c;
}
diff --git a/conf/conf.h b/conf/conf.h
index 78ab04a..5abca7d 100644
--- a/conf/conf.h
+++ b/conf/conf.h
@@ -10,6 +10,7 @@
#define _BIRD_CONF_H_
#include "lib/resource.h"
+#include "lib/timer.h"
/* Configuration structure */
@@ -29,6 +30,7 @@ struct config {
struct symbol **sym_fallback; /* Lexer: fallback symbol hash table */
int obstacle_count; /* Number of items blocking freeing of this config */
int shutdown; /* This is a pseudo-config for daemon shutdown */
+ bird_clock_t load_time; /* When we've got this configuration */
};
/* Please don't use these variables in protocols. Use proto_config->global instead. */
@@ -38,6 +40,7 @@ extern struct config *old_config; /* Old configuration when reconfiguration is i
extern struct config *future_config; /* New config held here if recon requested during recon */
extern int shutting_down;
+extern bird_clock_t boot_time;
struct config *config_alloc(byte *name);
int config_parse(struct config *);
diff --git a/doc/reply_codes b/doc/reply_codes
index 711c634..140de95 100644
--- a/doc/reply_codes
+++ b/doc/reply_codes
@@ -21,6 +21,7 @@ Reply codes of BIRD command-line interface
0010 Already enabled
0011 Enabled
0012 Restarted
+0013 Status report
1000 BIRD version
1001 Interface list
@@ -33,6 +34,7 @@ Reply codes of BIRD command-line interface
1008 Route details
1009 Static route list
1010 Symbol list
+1011 Uptime
8000 Reply too long
8001 Route not found
diff --git a/nest/cmds.c b/nest/cmds.c
index c4443f9..ac537c8 100644
--- a/nest/cmds.c
+++ b/nest/cmds.c
@@ -15,8 +15,21 @@
void
cmd_show_status(void)
{
- cli_msg(1000, "BIRD " BIRD_VERSION);
- /* FIXME: Should include uptime, shutdown flag et cetera */
+ byte tim[TM_DATETIME_BUFFER_SIZE];
+
+ cli_msg(-1000, "BIRD " BIRD_VERSION);
+ tm_format_datetime(tim, now);
+ cli_msg(-1011, "Current server time is %s", tim);
+ tm_format_datetime(tim, boot_time);
+ cli_msg(-1011, "Last reboot on %s", tim);
+ tm_format_datetime(tim, config->load_time);
+ cli_msg(-1011, "Last reconfiguration on %s", tim);
+ if (shutting_down)
+ cli_msg(13, "Shutdown in progress");
+ else if (old_config)
+ cli_msg(13, "Reconfiguration in progress");
+ else
+ cli_msg(13, "Daemon is up and running");
}
void