summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/command.c5
-rw-r--r--lib/command.h5
-rw-r--r--lib/vty.c39
-rw-r--r--lib/vty.h4
4 files changed, 52 insertions, 1 deletions
diff --git a/lib/command.c b/lib/command.c
index f1ec15c5..c3c9145d 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -89,6 +89,11 @@ Hello, this is " QUAGGA_PROGNAME " (version " QUAGGA_VERSION ").\r\n\
" QUAGGA_COPYRIGHT "\r\n\
\r\n";
+#ifdef QDEBUG
+const char *debug_banner =
+ QUAGGA_PROGNAME " version " QUAGGA_VERSION " QDEBUG=" QDEBUG " "
+ __DATE__ " " __TIME__;
+#endif
static struct facility_map {
int facility;
diff --git a/lib/command.h b/lib/command.h
index 9cc472a7..c0d79f94 100644
--- a/lib/command.h
+++ b/lib/command.h
@@ -381,4 +381,9 @@ extern struct host host;
/* "<cr>" global */
extern char *command_cr;
+
+#ifdef QDEBUG
+extern const char *debug_banner;
+#endif
+
#endif /* _ZEBRA_COMMAND_H */
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)
diff --git a/lib/vty.h b/lib/vty.h
index 577a6d50..ea5df68f 100644
--- a/lib/vty.h
+++ b/lib/vty.h
@@ -255,4 +255,8 @@ extern void vty_set_lines(struct vty *, int);
an async-signal-safe function. */
extern void vty_log_fixed (const char *buf, size_t len);
+#ifdef QDEBUG
+extern void vty_goodbye (void);
+#endif
+
#endif /* _ZEBRA_VTY_H */