*: Consolidate routemap initialization

Consolidate the routemap initialization into one
function.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2016-10-19 10:55:01 -04:00
parent 7526a1820e
commit b2575bc05b
10 changed files with 15 additions and 31 deletions

View File

@ -4578,7 +4578,7 @@ void
bgp_route_map_init (void)
{
route_map_init ();
route_map_init_vty ();
route_map_add_hook (bgp_route_map_add);
route_map_delete_hook (bgp_route_map_delete);
route_map_event_hook (bgp_route_map_event);

View File

@ -535,7 +535,6 @@ void
isis_route_map_init(void)
{
route_map_init();
route_map_init_vty();
route_map_install_match(&route_match_ip_address_cmd);
install_element(RMAP_NODE, &match_ip_address_cmd);

View File

@ -140,7 +140,6 @@ struct hash *route_map_dep_hash[ROUTE_MAP_DEP_MAX];
static unsigned int route_map_dep_hash_make_key (void *p);
static int route_map_dep_hash_cmp (const void *p1, const void *p2);
static void route_map_init_dep_hashes (void);
static void route_map_clear_all_references (char *rmap_name);
static void route_map_rule_delete (struct route_map_rule_list *,
struct route_map_rule *);
@ -1125,15 +1124,6 @@ route_map_event_hook (void (*func) (route_map_event_t, const char *))
route_map_master.event_hook = func;
}
void
route_map_init (void)
{
/* Make vector for match and set. */
route_match_vec = vector_init (1);
route_set_vec = vector_init (1);
route_map_master_hash = hash_create(route_map_hash_key_make, route_map_hash_cmp);
}
void
route_map_finish (void)
{
@ -1822,16 +1812,6 @@ static struct cmd_node rmap_node =
1
};
static void
route_map_init_dep_hashes (void)
{
int i;
for (i = 1; i < ROUTE_MAP_DEP_MAX; i++)
route_map_dep_hash[i] = hash_create(route_map_dep_hash_make_key,
route_map_dep_hash_cmp);
}
/* Common route map rules */
void *
@ -1860,9 +1840,18 @@ route_map_rule_tag_free (void *rule)
/* Initialization of route map vector. */
void
route_map_init_vty (void)
route_map_init (void)
{
route_map_init_dep_hashes();
int i;
/* Make vector for match and set. */
route_match_vec = vector_init (1);
route_set_vec = vector_init (1);
route_map_master_hash = hash_create(route_map_hash_key_make, route_map_hash_cmp);
for (i = 1; i < ROUTE_MAP_DEP_MAX; i++)
route_map_dep_hash[i] = hash_create(route_map_dep_hash_make_key,
route_map_dep_hash_cmp);
/* Install route map top node. */
install_node (&rmap_node, route_map_config_write);

View File

@ -182,7 +182,6 @@ DECLARE_QOBJ_TYPE(route_map)
/* Prototypes. */
extern void route_map_init (void);
extern void route_map_init_vty (void);
extern void route_map_finish (void);
/* Add match statement to route map. */

View File

@ -1331,7 +1331,7 @@ static void
ospf6_routemap_init (void)
{
route_map_init ();
route_map_init_vty ();
route_map_add_hook (ospf6_asbr_routemap_update);
route_map_delete_hook (ospf6_asbr_routemap_update);

View File

@ -946,7 +946,6 @@ void
ospf_route_map_init (void)
{
route_map_init ();
route_map_init_vty ();
route_map_add_hook (ospf_route_map_update);
route_map_delete_hook (ospf_route_map_update);

View File

@ -65,7 +65,7 @@ void
pim_route_map_init (void)
{
route_map_init ();
route_map_init_vty ();
route_map_add_hook (pim_route_map_add);
route_map_delete_hook (pim_route_map_delete);
route_map_event_hook (pim_route_map_event);

View File

@ -1070,7 +1070,7 @@ void
rip_route_map_init ()
{
route_map_init ();
route_map_init_vty ();
route_map_add_hook (rip_route_map_update);
route_map_delete_hook (rip_route_map_update);

View File

@ -683,7 +683,6 @@ void
ripng_route_map_init ()
{
route_map_init ();
route_map_init_vty ();
route_map_install_match (&route_match_metric_cmd);
route_map_install_match (&route_match_interface_cmd);

View File

@ -1811,7 +1811,6 @@ zebra_route_map_init ()
install_element (CONFIG_NODE, &no_zebra_route_map_timer_val_cmd);
route_map_init ();
route_map_init_vty ();
route_map_add_hook (zebra_route_map_add);
route_map_delete_hook (zebra_route_map_delete);