From 5ad4c39ce4c465bbedf56102ff8a25fe23ef6d7d Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 20 Jun 2018 18:48:35 +0000 Subject: [PATCH] *: stop double initialization of ferr * Stop double init of ferr * Fixup bugs in zebra ferr * Add missing init in ospfd Signed-off-by: Quentin Young --- babeld/babel_errors.c | 2 -- bgpd/bgp_errors.c | 2 -- eigrpd/eigrp_errors.c | 2 -- isisd/isis_errors.c | 2 -- lib/lib_errors.c | 1 - lib/libfrr.c | 1 + nhrpd/nhrp_errors.c | 2 -- ospfd/ospf_errors.c | 2 -- ospfd/ospf_main.c | 3 +++ pimd/pim_errors.c | 2 -- ripd/rip_errors.c | 2 -- watchfrr/watchfrr_errors.c | 2 -- zebra/main.c | 3 +++ zebra/zebra_errors.c | 5 +++-- zebra/zebra_errors.h | 2 +- 15 files changed, 11 insertions(+), 22 deletions(-) diff --git a/babeld/babel_errors.c b/babeld/babel_errors.c index ffcc3867fc..ec0ff5192a 100644 --- a/babeld/babel_errors.c +++ b/babeld/babel_errors.c @@ -57,7 +57,5 @@ static struct ferr_ref ferr_babel_err[] = { void babel_error_init(void) { - ferr_ref_init(); - ferr_ref_add(ferr_babel_err); } diff --git a/bgpd/bgp_errors.c b/bgpd/bgp_errors.c index 5535a2a8ad..c86178d99a 100644 --- a/bgpd/bgp_errors.c +++ b/bgpd/bgp_errors.c @@ -302,7 +302,5 @@ static struct ferr_ref ferr_bgp_err[] = { void bgp_error_init(void) { - ferr_ref_init(); - ferr_ref_add(ferr_bgp_err); } diff --git a/eigrpd/eigrp_errors.c b/eigrpd/eigrp_errors.c index 5732fc39c8..4e6337a7ba 100644 --- a/eigrpd/eigrp_errors.c +++ b/eigrpd/eigrp_errors.c @@ -45,7 +45,5 @@ static struct ferr_ref ferr_eigrp_err[] = { void eigrp_error_init(void) { - ferr_ref_init(); - ferr_ref_add(ferr_eigrp_err); } diff --git a/isisd/isis_errors.c b/isisd/isis_errors.c index d7425153a3..3f69a10cab 100644 --- a/isisd/isis_errors.c +++ b/isisd/isis_errors.c @@ -45,7 +45,5 @@ static struct ferr_ref ferr_isis_err[] = { void isis_error_init(void) { - ferr_ref_init(); - ferr_ref_add(ferr_isis_err); } diff --git a/lib/lib_errors.c b/lib/lib_errors.c index e08b03f17f..c659a7aae6 100644 --- a/lib/lib_errors.c +++ b/lib/lib_errors.c @@ -114,6 +114,5 @@ static struct ferr_ref ferr_lib_err[] = { void lib_error_init(void) { - ferr_ref_init(); ferr_ref_add(ferr_lib_err); } diff --git a/lib/libfrr.c b/lib/libfrr.c index 05b001b6de..154f19eae5 100644 --- a/lib/libfrr.c +++ b/lib/libfrr.c @@ -599,6 +599,7 @@ struct thread_master *frr_init(void) vty_init(master); memory_init(); + ferr_ref_init(); lib_error_init(); return master; diff --git a/nhrpd/nhrp_errors.c b/nhrpd/nhrp_errors.c index 71ec211136..3c0d4c3e5e 100644 --- a/nhrpd/nhrp_errors.c +++ b/nhrpd/nhrp_errors.c @@ -45,7 +45,5 @@ static struct ferr_ref ferr_nhrp_err[] = { void nhrp_error_init(void) { - ferr_ref_init(); - ferr_ref_add(ferr_nhrp_err); } diff --git a/ospfd/ospf_errors.c b/ospfd/ospf_errors.c index f4ae731a9b..244aa26953 100644 --- a/ospfd/ospf_errors.c +++ b/ospfd/ospf_errors.c @@ -80,7 +80,5 @@ static struct ferr_ref ferr_ospf_err[] = { void ospf_error_init(void) { - ferr_ref_init(); - ferr_ref_add(ferr_ospf_err); } diff --git a/ospfd/ospf_main.c b/ospfd/ospf_main.c index 1a25e27d7a..c3f919ef1e 100644 --- a/ospfd/ospf_main.c +++ b/ospfd/ospf_main.c @@ -207,6 +207,9 @@ int main(int argc, char **argv) ospf_route_map_init(); ospf_opaque_init(); + /* OSPF errors init */ + ospf_error_init(); + /* Need to initialize the default ospf structure, so the interface mode commands can be duly processed if they are received before 'router ospf', diff --git a/pimd/pim_errors.c b/pimd/pim_errors.c index 15f0345f0c..81e2bd5563 100644 --- a/pimd/pim_errors.c +++ b/pimd/pim_errors.c @@ -45,7 +45,5 @@ static struct ferr_ref ferr_pim_err[] = { void pim_error_init(void) { - ferr_ref_init(); - ferr_ref_add(ferr_pim_err); } diff --git a/ripd/rip_errors.c b/ripd/rip_errors.c index 4a2a2bd5a9..133d808524 100644 --- a/ripd/rip_errors.c +++ b/ripd/rip_errors.c @@ -37,7 +37,5 @@ static struct ferr_ref ferr_rip_err[] = { void rip_error_init(void) { - ferr_ref_init(); - ferr_ref_add(ferr_rip_err); } diff --git a/watchfrr/watchfrr_errors.c b/watchfrr/watchfrr_errors.c index 9a4842a5df..494132e52f 100644 --- a/watchfrr/watchfrr_errors.c +++ b/watchfrr/watchfrr_errors.c @@ -39,7 +39,5 @@ static struct ferr_ref ferr_watchfrr_err[] = { void watchfrr_error_init(void) { - ferr_ref_init(); - ferr_ref_add(ferr_watchfrr_err); } diff --git a/zebra/main.c b/zebra/main.c index 719a6ca59f..9453e54b61 100644 --- a/zebra/main.c +++ b/zebra/main.c @@ -413,6 +413,9 @@ int main(int argc, char **argv) /* RNH init */ zebra_rnh_init(); + + /* Error init */ + zebra_error_init(); #if defined(HANDLE_ZAPI_FUZZING) if (zapi_fuzzing) { diff --git a/zebra/zebra_errors.c b/zebra/zebra_errors.c index f657bdcdc7..39e3939bb2 100644 --- a/zebra/zebra_errors.c +++ b/zebra/zebra_errors.c @@ -265,13 +265,14 @@ static struct ferr_ref ferr_zebra_err[] = { .description = "Zebra attempted to add a VNI hash to an interface and failed", .suggestion = "Notify a developer.", }, + { + .code = END_FERR, + } }; /* clang-format on */ void zebra_error_init(void) { - ferr_ref_init(); - ferr_ref_add(ferr_zebra_err); } diff --git a/zebra/zebra_errors.h b/zebra/zebra_errors.h index 66771a33d6..f5f4894ece 100644 --- a/zebra/zebra_errors.h +++ b/zebra/zebra_errors.h @@ -24,7 +24,7 @@ #include "lib/ferr.h" enum zebra_ferr_refs { - ZEBRA_ERR_LM_RESPONSE, + ZEBRA_ERR_LM_RESPONSE = ZEBRA_FERR_START, ZEBRA_ERR_LM_NO_SUCH_CLIENT, ZEBRA_ERR_LM_RELAY_FAILED, ZEBRA_ERR_LM_NO_SOCKET, -- 2.39.5