Commit 8abba574 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Dump routing tables on SIGUSR1.

parent 21e6343a
...@@ -72,13 +72,12 @@ int protocol_port; ...@@ -72,13 +72,12 @@ int protocol_port;
unsigned char protocol_group[16]; unsigned char protocol_group[16];
int protocol_socket = -1; int protocol_socket = -1;
static volatile sig_atomic_t exiting = 0; static volatile sig_atomic_t exiting = 0, dumping = 0;
struct network *add_network(char *ifname, int ifindex, int bufsize, struct network *add_network(char *ifname, int ifindex, int bufsize,
int wired, unsigned int cost, int hello_interval); int wired, unsigned int cost, int hello_interval);
void expire_routes(void); void expire_routes(void);
static void sigexit(int signo);
static void init_signals(void); static void init_signals(void);
static void dump_tables(FILE *out); static void dump_tables(FILE *out);
...@@ -430,8 +429,10 @@ main(int argc, char **argv) ...@@ -430,8 +429,10 @@ main(int argc, char **argv)
} }
} }
if(debug) if(debug || dumping) {
dump_tables(stdout); dump_tables(stdout);
dumping = 0;
}
} }
debugf("Exiting...\n"); debugf("Exiting...\n");
...@@ -500,6 +501,12 @@ sigexit(int signo) ...@@ -500,6 +501,12 @@ sigexit(int signo)
exiting = 1; exiting = 1;
} }
static void
sigdump(int signo)
{
dumping = 1;
}
static void static void
init_signals(void) init_signals(void)
{ {
...@@ -523,6 +530,12 @@ init_signals(void) ...@@ -523,6 +530,12 @@ init_signals(void)
sa.sa_mask = ss; sa.sa_mask = ss;
sa.sa_flags = 0; sa.sa_flags = 0;
sigaction(SIGINT, &sa, NULL); sigaction(SIGINT, &sa, NULL);
sigemptyset(&ss);
sa.sa_handler = sigdump;
sa.sa_mask = ss;
sa.sa_flags = 0;
sigaction(SIGUSR1, &sa, NULL);
} }
static void static void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment