babeld: state-file was loaded too early. Initial seqno too.
diff --git a/babeld/babel_main.c b/babeld/babel_main.c
index c039c88..951da7d 100644
--- a/babeld/babel_main.c
+++ b/babeld/babel_main.c
@@ -68,7 +68,6 @@
static void babel_fail(void);
static void babel_init_random(void);
static void babel_replace_by_null(int fd);
-static void babel_load_state_file(void);
static void babel_init_signals(void);
static void babel_exit_properly(void);
static void babel_save_state_file(void);
@@ -304,9 +303,6 @@
zlog_set_level (NULL, ZLOG_DEST_STDOUT, ZLOG_DISABLED);
vty_read_config (babel_config_file, babel_config_default);
- myseqno = (random() & 0xFFFF);
- babel_load_state_file();
-
/* Create VTY socket */
vty_serv_sock (babel_vty_addr, babel_vty_port, BABEL_VTYSH_PATH);
@@ -380,7 +376,7 @@
Load the state file: check last babeld's running state, usefull in case of
"/etc/init.d/babeld restart"
*/
-static void
+void
babel_load_state_file(void)
{
time_t reboot_time;
diff --git a/babeld/babel_main.h b/babeld/babel_main.h
index fb22c58..2afebc9 100644
--- a/babeld/babel_main.h
+++ b/babeld/babel_main.h
@@ -54,4 +54,5 @@
extern int kernel_socket;
extern int max_request_hopcount;
+void babel_load_state_file(void);
void show_babel_main_configuration (struct vty *vty);
diff --git a/babeld/babeld.c b/babeld/babeld.c
index d69662c..33b5d9e 100644
--- a/babeld/babeld.c
+++ b/babeld/babeld.c
@@ -173,7 +173,9 @@
static int
babel_init_routing_process(struct thread *thread)
{
+ myseqno = (random() & 0xFFFF);
babel_get_myid();
+ babel_load_state_file();
debugf(BABEL_DEBUG_COMMON, "My ID is : %s.", format_eui64(myid));
babel_initial_noise();
babel_main_loop(thread);/* this function self-add to the t_update thread */