summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ripngd/ripng_interface.c32
-rw-r--r--ripngd/ripngd.c2
-rw-r--r--ripngd/ripngd.h3
3 files changed, 21 insertions, 16 deletions
diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c
index fff727ffd2..dbf9a2c333 100644
--- a/ripngd/ripng_interface.c
+++ b/ripngd/ripng_interface.c
@@ -446,18 +446,18 @@ int ripng_interface_address_delete(int command, struct zclient *zclient,
return 0;
}
-/* RIPng enable network table. */
-struct agg_table *ripng_enable_network;
-
/* Lookup RIPng enable network. */
/* Check wether the interface has at least a connected prefix that
- * is within the ripng_enable_network table. */
+ * is within the ripng->enable_network table. */
static int ripng_enable_network_lookup_if(struct interface *ifp)
{
struct listnode *node;
struct connected *connected;
struct prefix_ipv6 address;
+ if (!ripng)
+ return -1;
+
for (ALL_LIST_ELEMENTS_RO(ifp->connected, node, connected)) {
struct prefix *p;
struct agg_node *n;
@@ -469,7 +469,7 @@ static int ripng_enable_network_lookup_if(struct interface *ifp)
address.prefix = p->u.prefix6;
address.prefixlen = IPV6_MAX_BITLEN;
- n = agg_node_match(ripng_enable_network,
+ n = agg_node_match(ripng->enable_network,
(struct prefix *)&address);
if (n) {
agg_unlock_node(n);
@@ -480,12 +480,15 @@ static int ripng_enable_network_lookup_if(struct interface *ifp)
return -1;
}
-/* Check wether connected is within the ripng_enable_network table. */
+/* Check wether connected is within the ripng->enable_network table. */
static int ripng_enable_network_lookup2(struct connected *connected)
{
struct prefix_ipv6 address;
struct prefix *p;
+ if (!ripng)
+ return -1;
+
p = connected->address;
if (p->family == AF_INET6) {
@@ -496,8 +499,8 @@ static int ripng_enable_network_lookup2(struct connected *connected)
address.prefixlen = IPV6_MAX_BITLEN;
/* LPM on p->family, p->u.prefix6/IPV6_MAX_BITLEN within
- * ripng_enable_network */
- node = agg_node_match(ripng_enable_network,
+ * ripng->enable_network */
+ node = agg_node_match(ripng->enable_network,
(struct prefix *)&address);
if (node) {
@@ -514,7 +517,7 @@ int ripng_enable_network_add(struct prefix *p)
{
struct agg_node *node;
- node = agg_node_get(ripng_enable_network, p);
+ node = agg_node_get(ripng->enable_network, p);
if (node->info) {
agg_unlock_node(node);
@@ -533,7 +536,7 @@ int ripng_enable_network_delete(struct prefix *p)
{
struct agg_node *node;
- node = agg_node_lookup(ripng_enable_network, p);
+ node = agg_node_lookup(ripng->enable_network, p);
if (node) {
node->info = NULL;
@@ -743,8 +746,8 @@ void ripng_clean_network()
char *str;
struct agg_node *rn;
- /* ripng_enable_network */
- for (rn = agg_route_top(ripng_enable_network); rn;
+ /* ripng->enable_network */
+ for (rn = agg_route_top(ripng->enable_network); rn;
rn = agg_route_next(rn))
if (rn->info) {
rn->info = NULL;
@@ -852,7 +855,7 @@ int ripng_network_write(struct vty *vty)
char buf[BUFSIZ];
/* Write enable network. */
- for (node = agg_route_top(ripng_enable_network); node;
+ for (node = agg_route_top(ripng->enable_network); node;
node = agg_route_next(node))
if (node->info) {
struct prefix *p = &node->p;
@@ -934,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 enable network init. */
- ripng_enable_network = agg_table_init();
-
/* RIPng passive interface. */
Vripng_passive_interface = vector_init(1);
diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c
index d54217d121..9158cdcd3f 100644
--- a/ripngd/ripngd.c
+++ b/ripngd/ripngd.c
@@ -1806,6 +1806,7 @@ int ripng_create(int socket)
/* Initialize RIPng data structures. */
ripng->table = agg_table_init();
ripng->enable_if = vector_init(1);
+ ripng->enable_network = agg_table_init();
/* Distribute list install. */
ripng->distribute_ctx = distribute_list_ctx_create(
@@ -2463,6 +2464,7 @@ void ripng_clean()
ripng_clean_network();
ripng_passive_interface_clean();
vector_free(ripng->enable_if);
+ agg_table_finish(ripng->enable_network);
ripng_offset_clean();
ripng_interface_clean();
ripng_redistribute_clean();
diff --git a/ripngd/ripngd.h b/ripngd/ripngd.h
index af2f65eb46..935a9e8591 100644
--- a/ripngd/ripngd.h
+++ b/ripngd/ripngd.h
@@ -111,6 +111,9 @@ struct ripng {
/* RIPng enabled interfaces. */
vector enable_if;
+ /* RIPng enabled networks. */
+ struct agg_table *enable_network;
+
/* RIPng threads. */
struct thread *t_read;
struct thread *t_write;