summaryrefslogtreecommitdiffstats
path: root/ripngd
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
commit56bf1cb2c3236429ff77e5dd19b04a8d1ff5d158 (patch)
tree0cfd6ad5d07d0492e58a7f29992770e1bab6c2a8 /ripngd
parentripngd: move "peer_list" to the ripng structure (diff)
downloadfrr-56bf1cb2c3236429ff77e5dd19b04a8d1ff5d158.tar.xz
frr-56bf1cb2c3236429ff77e5dd19b04a8d1ff5d158.zip
ripdng: clear list of peers when RIPng is deconfigured
This is an old standing bug where the list of RIPng peers wasn't cleared after deconfiguring RIPng, which caused the existing peers to still be present on a newly configured RIPng instance (except when the timed out after ~3 minutes). Fix this. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ripngd')
-rw-r--r--ripngd/ripng_peer.c6
-rw-r--r--ripngd/ripngd.c2
-rw-r--r--ripngd/ripngd.h1
3 files changed, 9 insertions, 0 deletions
diff --git a/ripngd/ripng_peer.c b/ripngd/ripng_peer.c
index f5590cf82..36c701b86 100644
--- a/ripngd/ripng_peer.c
+++ b/ripngd/ripng_peer.c
@@ -41,6 +41,7 @@ static struct ripng_peer *ripng_peer_new(void)
static void ripng_peer_free(struct ripng_peer *peer)
{
+ RIPNG_TIMER_OFF(peer->t_timeout);
XFREE(MTYPE_RIPNG_PEER, peer);
}
@@ -178,3 +179,8 @@ int ripng_peer_list_cmp(struct ripng_peer *p1, struct ripng_peer *p2)
{
return memcmp(&p1->addr, &p2->addr, sizeof(struct in6_addr));
}
+
+void ripng_peer_list_del(void *arg)
+{
+ ripng_peer_free(arg);
+}
diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c
index 2cc3bd7f1..9456980e8 100644
--- a/ripngd/ripngd.c
+++ b/ripngd/ripngd.c
@@ -1807,6 +1807,7 @@ int ripng_create(int socket)
ripng->table = agg_table_init();
ripng->peer_list = list_new();
ripng->peer_list->cmp = (int (*)(void *, void *))ripng_peer_list_cmp;
+ ripng->peer_list->del = ripng_peer_list_del;
ripng->enable_if = vector_init(1);
ripng->enable_network = agg_table_init();
ripng->passive_interface = vector_init(1);
@@ -2459,6 +2460,7 @@ void ripng_clean()
free(ripng->route_map[i].name);
agg_table_finish(ripng->table);
+ list_delete(&ripng->peer_list);
distribute_list_delete(&ripng->distribute_ctx);
stream_free(ripng->ibuf);
diff --git a/ripngd/ripngd.h b/ripngd/ripngd.h
index 3e5ca18ed..26b6c0bb1 100644
--- a/ripngd/ripngd.h
+++ b/ripngd/ripngd.h
@@ -377,6 +377,7 @@ extern void ripng_peer_display(struct vty *);
extern struct ripng_peer *ripng_peer_lookup(struct in6_addr *);
extern struct ripng_peer *ripng_peer_lookup_next(struct in6_addr *);
extern int ripng_peer_list_cmp(struct ripng_peer *p1, struct ripng_peer *p2);
+extern void ripng_peer_list_del(void *arg);
extern struct ripng_offset_list *ripng_offset_list_new(const char *ifname);
extern void ripng_offset_list_del(struct ripng_offset_list *offset);