0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 09:41:54 +00:00

Made `show status' show uptime and time of last reconfiguration.

This commit is contained in:
Martin Mares 2000-03-12 22:44:54 +00:00
parent 7a88832e78
commit 4327090276
4 changed files with 25 additions and 2 deletions

View File

@ -18,6 +18,7 @@
#include "lib/resource.h" #include "lib/resource.h"
#include "lib/string.h" #include "lib/string.h"
#include "lib/event.h" #include "lib/event.h"
#include "lib/timer.h"
#include "conf/conf.h" #include "conf/conf.h"
#include "filter/filter.h" #include "filter/filter.h"
@ -26,6 +27,7 @@ static jmp_buf conf_jmpbuf;
struct config *config, *new_config, *old_config, *future_config; struct config *config, *new_config, *old_config, *future_config;
static event *config_event; static event *config_event;
int shutting_down; int shutting_down;
bird_clock_t boot_time;
struct config * struct config *
config_alloc(byte *name) config_alloc(byte *name)
@ -37,6 +39,9 @@ config_alloc(byte *name)
c->pool = p; c->pool = p;
cfg_mem = c->mem = l; cfg_mem = c->mem = l;
c->file_name = cfg_strdup(name); c->file_name = cfg_strdup(name);
c->load_time = now;
if (!boot_time)
boot_time = now;
return c; return c;
} }

View File

@ -10,6 +10,7 @@
#define _BIRD_CONF_H_ #define _BIRD_CONF_H_
#include "lib/resource.h" #include "lib/resource.h"
#include "lib/timer.h"
/* Configuration structure */ /* Configuration structure */
@ -29,6 +30,7 @@ struct config {
struct symbol **sym_fallback; /* Lexer: fallback symbol hash table */ struct symbol **sym_fallback; /* Lexer: fallback symbol hash table */
int obstacle_count; /* Number of items blocking freeing of this config */ int obstacle_count; /* Number of items blocking freeing of this config */
int shutdown; /* This is a pseudo-config for daemon shutdown */ 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. */ /* 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 struct config *future_config; /* New config held here if recon requested during recon */
extern int shutting_down; extern int shutting_down;
extern bird_clock_t boot_time;
struct config *config_alloc(byte *name); struct config *config_alloc(byte *name);
int config_parse(struct config *); int config_parse(struct config *);

View File

@ -21,6 +21,7 @@ Reply codes of BIRD command-line interface
0010 Already enabled 0010 Already enabled
0011 Enabled 0011 Enabled
0012 Restarted 0012 Restarted
0013 Status report
1000 BIRD version 1000 BIRD version
1001 Interface list 1001 Interface list
@ -33,6 +34,7 @@ Reply codes of BIRD command-line interface
1008 Route details 1008 Route details
1009 Static route list 1009 Static route list
1010 Symbol list 1010 Symbol list
1011 Uptime
8000 Reply too long 8000 Reply too long
8001 Route not found 8001 Route not found

View File

@ -15,8 +15,21 @@
void void
cmd_show_status(void) cmd_show_status(void)
{ {
cli_msg(1000, "BIRD " BIRD_VERSION); byte tim[TM_DATETIME_BUFFER_SIZE];
/* FIXME: Should include uptime, shutdown flag et cetera */
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 void