From 1a88dd5744496aaf1fe5c2d4a859cae0612fdff3 Mon Sep 17 00:00:00 2001 From: paulo Date: Fri, 18 Dec 2009 16:48:20 +0000 Subject: QDEBUG handling. Debug banner on stderr, vty and log file. Annouce before and after reading config file. Announce on all vty when shutting down. --- lib/vty.c | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'lib/vty.c') diff --git a/lib/vty.c b/lib/vty.c index f057536f..4104af76 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -338,6 +338,9 @@ static void uty_hello (struct vty *vty) { ASSERTLOCKED +#ifdef QDEBUG + uty_out (vty, "%s%s", debug_banner, VTY_NEWLINE); +#endif if (host.motdfile) { FILE *f; @@ -358,7 +361,7 @@ uty_hello (struct vty *vty) fclose (f); } else - uty_out (vty, "MOTD file not found%s", VTY_NEWLINE); + uty_out (vty, "MOTD file %s not found%s", host.motdfile, VTY_NEWLINE); } else if (host.motd) uty_out (vty, "%s", host.motd); @@ -2821,7 +2824,13 @@ vty_read_config (char *config_file, fclose (confp); +#ifdef QDEBUG + fprintf(stderr, "Reading config file: %s\n", fullpath); +#endif host_config_set (fullpath); +#ifdef QDEBUG + fprintf(stderr, "Finished reading config file\n"); +#endif if (tmp) XFREE (MTYPE_TMP, fullpath); @@ -2850,6 +2859,34 @@ vty_log (const char *level, const char *proto_str, } } +#ifdef QDEBUG +/* Tell all terminals that we are shutting down */ +void +vty_goodbye (void) +{ + unsigned int i; + struct vty *vty; + + LOCK + + if (vtyvec) + { + for (i = 0; i < vector_active (vtyvec); i++) + if (((vty = vector_slot (vtyvec, i)) != NULL) && vty->type == VTY_TERM) + uty_out(vty, QUAGGA_PROGNAME " is shutting down%s", VTY_NEWLINE); + + /* Wake up */ + if (cli_nexus) + { + vty_event (VTY_WRITE, vty->fd, vty); + qpt_thread_signal(cli_nexus->thread_id, SIGMQUEUE); + } + } + + UNLOCK +} +#endif + /* Async-signal-safe version of vty_log for fixed strings. */ void vty_log_fixed (const char *buf, size_t len) -- cgit v1.2.3