1998-05-15 15:56:13 +08:00
|
|
|
/*
|
|
|
|
* BIRD Internet Routing Daemon -- Unix Entry Point
|
|
|
|
*
|
|
|
|
* (c) 1998 Martin Mares <mj@ucw.cz>
|
|
|
|
*
|
|
|
|
* Can be freely distributed and used under the terms of the GNU GPL.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
1998-05-24 22:50:18 +08:00
|
|
|
#include <sys/signal.h>
|
1998-05-15 15:56:13 +08:00
|
|
|
|
|
|
|
#include "nest/bird.h"
|
|
|
|
#include "lib/lists.h"
|
|
|
|
#include "lib/resource.h"
|
1998-05-24 22:50:18 +08:00
|
|
|
#include "lib/socket.h"
|
1998-05-15 15:56:13 +08:00
|
|
|
#include "nest/route.h"
|
1998-05-24 22:50:18 +08:00
|
|
|
#include "nest/protocol.h"
|
1998-05-27 05:42:05 +08:00
|
|
|
#include "nest/iface.h"
|
1998-06-03 16:43:44 +08:00
|
|
|
#include "nest/confile.h"
|
1998-05-24 22:50:18 +08:00
|
|
|
|
|
|
|
#include "unix.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Debugging
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
handle_sigusr(int sig)
|
|
|
|
{
|
|
|
|
debug("SIGUSR1: Debugging dump...\n\n");
|
|
|
|
|
|
|
|
sk_dump_all();
|
|
|
|
tm_dump_all();
|
1998-05-27 05:42:05 +08:00
|
|
|
if_dump_all();
|
1998-06-02 05:41:32 +08:00
|
|
|
neigh_dump_all();
|
1998-05-24 22:50:18 +08:00
|
|
|
rta_dump_all();
|
|
|
|
rt_dump_all();
|
1998-07-10 03:37:39 +08:00
|
|
|
protos_dump_all();
|
1998-05-24 22:50:18 +08:00
|
|
|
|
|
|
|
debug("\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
signal_init(void)
|
|
|
|
{
|
|
|
|
static struct sigaction sa;
|
|
|
|
|
|
|
|
sa.sa_handler = handle_sigusr;
|
|
|
|
sa.sa_flags = SA_RESTART;
|
|
|
|
if (sigaction(SIGUSR1, &sa, NULL) < 0)
|
|
|
|
die("sigaction: %m");
|
|
|
|
signal(SIGPIPE, SIG_IGN);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
1998-06-03 16:43:44 +08:00
|
|
|
* Config Pool
|
1998-05-24 22:50:18 +08:00
|
|
|
*/
|
|
|
|
|
1998-06-03 16:43:44 +08:00
|
|
|
pool *cfg_pool;
|
|
|
|
mempool *cfg_mem;
|
1998-05-24 22:50:18 +08:00
|
|
|
|
1998-06-03 16:43:44 +08:00
|
|
|
/*
|
|
|
|
* Hic Est main()
|
|
|
|
*/
|
1998-05-15 15:56:13 +08:00
|
|
|
|
|
|
|
int
|
|
|
|
main(void)
|
|
|
|
{
|
|
|
|
log(L_INFO "Launching BIRD -1.-1-pre-omega...");
|
|
|
|
|
|
|
|
log_init_debug(NULL);
|
|
|
|
resource_init();
|
1998-06-03 16:43:44 +08:00
|
|
|
cfg_pool = rp_new(&root_pool, "Config");
|
|
|
|
cfg_mem = mp_new(cfg_pool, 1024);
|
|
|
|
|
1998-05-24 22:50:18 +08:00
|
|
|
io_init();
|
1998-05-20 19:54:33 +08:00
|
|
|
rt_init();
|
1998-05-27 05:42:05 +08:00
|
|
|
if_init();
|
1998-05-24 22:50:18 +08:00
|
|
|
protos_init();
|
1998-06-03 16:43:44 +08:00
|
|
|
protos_preconfig();
|
|
|
|
protos_postconfig();
|
1998-05-27 05:42:05 +08:00
|
|
|
|
1998-05-24 22:50:18 +08:00
|
|
|
signal_init();
|
|
|
|
|
1998-06-03 16:43:44 +08:00
|
|
|
protos_start();
|
|
|
|
|
1998-10-14 21:38:17 +08:00
|
|
|
scan_if_init();
|
|
|
|
|
1998-05-27 05:42:05 +08:00
|
|
|
handle_sigusr(0);
|
|
|
|
|
|
|
|
debug("Entering I/O loop.\n");
|
1998-05-15 15:56:13 +08:00
|
|
|
|
1998-05-24 22:50:18 +08:00
|
|
|
io_loop();
|
|
|
|
die("I/O loop died");
|
1998-05-15 15:56:13 +08:00
|
|
|
}
|