#include "log.h"
#include "privs.h"
#include "sigevent.h"
+#include "vrf.h"
#include "zebra/rib.h"
+#include "zebra/zebra_ns.h"
#include "zebra/zserv.h"
+#include "zebra/zebra_vrf.h"
#include "zebra/debug.h"
#include "zebra/router-id.h"
#include "zebra/interface.h"
/* process id. */
pid_t pid;
+/* Allow non-quagga entities to delete quagga routes */
+int allow_delete = 0;
+
/* zebra_rib's workqueue hold time. Private export for use by test code only */
extern int rib_process_hold_time;
/* Command line options. */
struct option longopts[] =
{
- { "batch", no_argument, NULL, 'b'},
- { "daemon", no_argument, NULL, 'd'},
- { "log_mode", no_argument, NULL, 'l'},
- { "config_file", required_argument, NULL, 'f'},
- { "help", no_argument, NULL, 'h'},
- { "vty_addr", required_argument, NULL, 'A'},
- { "vty_port", required_argument, NULL, 'P'},
- { "version", no_argument, NULL, 'v'},
- { "rib_hold", required_argument, NULL, 'r'},
+ { "batch", no_argument, NULL, 'b'},
+ { "daemon", no_argument, NULL, 'd'},
+ { "allow_delete", no_argument, NULL, 'a'},
+ { "config_file", required_argument, NULL, 'f'},
+ { "help", no_argument, NULL, 'h'},
+ { "vty_addr", required_argument, NULL, 'A'},
+ { "vty_port", required_argument, NULL, 'P'},
+ { "version", no_argument, NULL, 'v'},
+ { "rib_hold", required_argument, NULL, 'r'},
{ 0 }
};
"redistribution between different routing protocols.\n\n"\
"-b, --batch Runs in batch mode\n"\
"-d, --daemon Runs in daemon mode\n"\
+ "-a, --allow_delete Allow other processes to delete Quagga Routes\n" \
"-f, --config_file Set configuration file name\n"\
- "-l, --log_mode Set verbose log mode flag\n"\
"-A, --vty_addr Set vty's bind address\n"\
"-P, --vty_port Set vty's port number\n"\
"-r, --rib_hold Set rib-queue hold time\n"\
exit (status);
}
-\f
-static unsigned int test_ifindex = 0;
+
+static ifindex_t test_ifindex = 0;
/* testrib commands */
DEFUN (test_interface_state,
{
install_element (INTERFACE_NODE, &test_interface_state_cmd);
}
-\f
+
/* SIGHUP handler. */
static void
sighup (void)
.handler = &sigint,
},
};
-\f
/* Main startup routine. */
int
main (int argc, char **argv)
/* preserve my name */
progname = ((p = strrchr (argv[0], '/')) ? ++p : argv[0]);
- zlog_default = openzlog (progname, ZLOG_ZEBRA,
+ zlog_default = openzlog (progname, ZLOG_ZEBRA, 0,
LOG_CONS|LOG_NDELAY|LOG_PID, LOG_DAEMON);
while (1)
{
int opt;
- opt = getopt_long (argc, argv, "bdlf:hA:P:r:v", longopts, 0);
+ opt = getopt_long (argc, argv, "bdaf:hA:P:r:v", longopts, 0);
if (opt == EOF)
break;
case 'd':
daemon_mode = 1;
break;
- case 'l':
- /* log_mode = 1; */
+ case 'a':
+ allow_delete =1;
break;
case 'f':
config_file = optarg;
/* port and conf file mandatory */
if (!vty_port || !config_file)
- usage (progname, 1);
+ {
+ fprintf (stderr, "Error: --vty_port and --config_file arguments"
+ " are both required\n");
+ usage (progname, 1);
+ }
/* Make master thread emulator. */
zebrad.master = thread_master_create ();
/* Vty related initialize. */
- signal_init (zebrad.master, Q_SIGC(zebra_signals), zebra_signals);
+ signal_init (zebrad.master, array_size(zebra_signals), zebra_signals);
cmd_init (1);
vty_init (zebrad.master);
memory_init ();
- if_init();
zebra_debug_init ();
zebra_if_init ();
test_cmd_init ();
access_list_init ();
/* Make kernel routing socket. */
- kernel_init ();
- route_read ();
+ zebra_vrf_init ();
zebra_vty_init();
- /* Sort VTY commands. */
- sort_node ();
-
/* Configuration file read*/
vty_read_config (config_file, config_default);
exit (0);
/* Daemonize. */
- if (daemon_mode)
- daemon (0, 0);
+ if (daemon_mode && daemon (0, 0) < 0)
+ {
+ perror("daemon start failed");
+ exit (1);
+ }
/* Needed for BSD routing socket. */
pid = getpid ();