summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2019-01-04 22:08:10 +0100
committerRenato Westphal <renato@opensourcerouting.org>2019-01-18 19:15:41 +0100
commit0c32404fddcf80034f4fd3d76c7cc12fd71b4e25 (patch)
treef2d9ca1368ca4f5c64f22111cf5d8ef26e2b859d
parentripngd: move "ripng_enable_network" to the ripng structure (diff)
downloadfrr-0c32404fddcf80034f4fd3d76c7cc12fd71b4e25.tar.xz
frr-0c32404fddcf80034f4fd3d76c7cc12fd71b4e25.zip
ripngd: move "Vripng_passive_interface" to the ripng structure
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
-rw-r--r--ripngd/ripng_interface.c25
-rw-r--r--ripngd/ripngd.c2
-rw-r--r--ripngd/ripngd.h3
3 files changed, 16 insertions, 14 deletions
diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c
index dbf9a2c33..b0a07ab46 100644
--- a/ripngd/ripng_interface.c
+++ b/ripngd/ripng_interface.c
@@ -762,17 +762,17 @@ void ripng_clean_network()
}
}
-/* Vector to store passive-interface name. */
-vector Vripng_passive_interface;
-
/* Utility function for looking up passive interface settings. */
static int ripng_passive_interface_lookup(const char *ifname)
{
unsigned int i;
char *str;
- for (i = 0; i < vector_active(Vripng_passive_interface); i++)
- if ((str = vector_slot(Vripng_passive_interface, i)) != NULL)
+ if (!ripng)
+ return -1;
+
+ for (i = 0; i < vector_active(ripng->passive_interface); i++)
+ if ((str = vector_slot(ripng->passive_interface, i)) != NULL)
if (strcmp(str, ifname) == 0)
return i;
return -1;
@@ -807,7 +807,7 @@ int ripng_passive_interface_set(const char *ifname)
if (ripng_passive_interface_lookup(ifname) >= 0)
return NB_ERR_INCONSISTENCY;
- vector_set(Vripng_passive_interface, strdup(ifname));
+ vector_set(ripng->passive_interface, strdup(ifname));
ripng_passive_interface_apply_all();
@@ -823,9 +823,9 @@ int ripng_passive_interface_unset(const char *ifname)
if (i < 0)
return NB_ERR_INCONSISTENCY;
- str = vector_slot(Vripng_passive_interface, i);
+ str = vector_slot(ripng->passive_interface, i);
free(str);
- vector_unset(Vripng_passive_interface, i);
+ vector_unset(ripng->passive_interface, i);
ripng_passive_interface_apply_all();
@@ -838,10 +838,10 @@ void ripng_passive_interface_clean(void)
unsigned int i;
char *str;
- for (i = 0; i < vector_active(Vripng_passive_interface); i++)
- if ((str = vector_slot(Vripng_passive_interface, i)) != NULL) {
+ for (i = 0; i < vector_active(ripng->passive_interface); i++)
+ if ((str = vector_slot(ripng->passive_interface, i)) != NULL) {
free(str);
- vector_slot(Vripng_passive_interface, i) = NULL;
+ vector_slot(ripng->passive_interface, i) = NULL;
}
ripng_passive_interface_apply_all();
}
@@ -937,9 +937,6 @@ void ripng_if_init()
hook_register_prio(if_add, 0, ripng_if_new_hook);
hook_register_prio(if_del, 0, ripng_if_delete_hook);
- /* RIPng passive interface. */
- Vripng_passive_interface = vector_init(1);
-
/* Install interface node. */
install_node(&interface_node, interface_config_write);
if_cmd_init();
diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c
index 9158cdcd3..7db8bafd3 100644
--- a/ripngd/ripngd.c
+++ b/ripngd/ripngd.c
@@ -1807,6 +1807,7 @@ int ripng_create(int socket)
ripng->table = agg_table_init();
ripng->enable_if = vector_init(1);
ripng->enable_network = agg_table_init();
+ ripng->passive_interface = vector_init(1);
/* Distribute list install. */
ripng->distribute_ctx = distribute_list_ctx_create(
@@ -2465,6 +2466,7 @@ void ripng_clean()
ripng_passive_interface_clean();
vector_free(ripng->enable_if);
agg_table_finish(ripng->enable_network);
+ vector_free(ripng->passive_interface);
ripng_offset_clean();
ripng_interface_clean();
ripng_redistribute_clean();
diff --git a/ripngd/ripngd.h b/ripngd/ripngd.h
index 935a9e859..95b128f4d 100644
--- a/ripngd/ripngd.h
+++ b/ripngd/ripngd.h
@@ -114,6 +114,9 @@ struct ripng {
/* RIPng enabled networks. */
struct agg_table *enable_network;
+ /* Vector to store passive-interface name. */
+ vector passive_interface;
+
/* RIPng threads. */
struct thread *t_read;
struct thread *t_write;