#include "filter.h"
#include "plist.h"
#include "lib_errors.h"
+#include "network.h"
#include "babel_main.h"
#include "babeld.h"
#include "babel_zebra.h"
#include "babel_errors.h"
-DEFINE_MGROUP(BABELD, "babeld")
-DEFINE_MTYPE_STATIC(BABELD, BABEL, "Babel Structure")
+DEFINE_MGROUP(BABELD, "babeld");
+DEFINE_MTYPE_STATIC(BABELD, BABEL, "Babel Structure");
static int babel_init_routing_process(struct thread *thread);
static void babel_get_myid(void);
static time_t source_expiry_time;
/* Babel node structure. */
+static int babel_config_write (struct vty *vty);
static struct cmd_node cmd_babel_node =
{
+ .name = "babel",
.node = BABEL_NODE,
+ .parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
- .vtysh = 1,
+ .config_write = babel_config_write,
};
/* print current babel configuration on vty */
static int
babel_init_routing_process(struct thread *thread)
{
- myseqno = (random() & 0xFFFF);
+ myseqno = (frr_weak_random() & 0xFFFF);
babel_get_myid();
babel_load_state_file();
debugf(BABEL_DEBUG_COMMON, "My ID is : %s.", format_eui64(myid));
return;
}
- flog_err(EC_BABEL_CONFIG,
- "Warning: couldn't find router id -- using random value.");
+ flog_err(EC_BABEL_CONFIG, "Couldn't find router id -- using random value.");
rc = read_random_bytes(myid, 8);
if(rc < 0) {
flush_all_routes();
babel_interface_close_all();
- /* cancel threads */
- if (babel_routing_process->t_read != NULL) {
- thread_cancel(babel_routing_process->t_read);
- }
- if (babel_routing_process->t_update != NULL) {
- thread_cancel(babel_routing_process->t_update);
- }
+ /* cancel events */
+ thread_cancel(&babel_routing_process->t_read);
+ thread_cancel(&babel_routing_process->t_update);
distribute_list_delete(&babel_routing_process->distribute_ctx);
XFREE(MTYPE_BABEL, babel_routing_process);
babel_set_timer(struct timeval *timeout)
{
long msecs = timeout->tv_sec * 1000 + timeout->tv_usec / 1000;
- if (babel_routing_process->t_update != NULL) {
- thread_cancel(babel_routing_process->t_update);
- }
+ thread_cancel(&(babel_routing_process->t_update));
thread_add_timer_msec(master, babel_main_loop, NULL, msecs, &babel_routing_process->t_update);
}
babeld_quagga_init(void)
{
- install_node(&cmd_babel_node, &babel_config_write);
+ install_node(&cmd_babel_node);
install_element(CONFIG_NODE, &router_babel_cmd);
install_element(CONFIG_NODE, &no_router_babel_cmd);