summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_main.c20
-rw-r--r--lib/command.c5
-rw-r--r--lib/command.h5
-rw-r--r--lib/vty.c39
-rw-r--r--lib/vty.h4
5 files changed, 71 insertions, 2 deletions
diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c
index 1be1d77c..4b030db5 100644
--- a/bgpd/bgp_main.c
+++ b/bgpd/bgp_main.c
@@ -202,6 +202,9 @@ sighup (void)
void
sigint (void)
{
+#ifdef QDEBUG
+ vty_goodbye();
+#endif
zlog_notice ("Terminating on signal");
if (! retain_mode)
@@ -354,6 +357,10 @@ main (int argc, char **argv)
/* Set umask before anything for security */
umask (0027);
+#ifdef QDEBUG
+ fprintf(stderr, "%s\n", debug_banner);
+#endif
+
qlib_init_first_stage();
/* Preserve name of myself. */
@@ -472,6 +479,13 @@ main (int argc, char **argv)
zlog_err("BGPd daemon failed: %s", strerror(errno));
return (1);
}
+#ifdef QDEBUG
+ if (daemon_mode)
+ {
+ fprintf(stderr, "BGPd daemonised\n");
+ zlog_notice("BGPd daemonised");
+ }
+#endif
/* Process ID file creation. */
pid_output (pid_file);
@@ -491,10 +505,14 @@ main (int argc, char **argv)
vty_serv_sock (vty_addr, vty_port, BGP_VTYSH_PATH);
/* Print banner. */
+#ifdef QDEBUG
+ zlog_notice("%s", debug_banner);
+#endif
zlog_notice ("BGPd %s starting: vty@%d, bgp@%s:%d", QUAGGA_VERSION,
vty_port,
(bm->address ? bm->address : "<all>"),
- bm->port);
+ (int)bm->port);
+
/* Launch finite state machines */
if (qpthreads_enabled)
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 */