summaryrefslogtreecommitdiffstats
path: root/ripd
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
commit711915d2cdef4dcf41c6921f98de29946cab500e (patch)
tree6ea7980b56b254c88fad5f9db0f74b27fb79c21a /ripd
parentripd: move "rip_distance_table" to the rip structure (diff)
downloadfrr-711915d2cdef4dcf41c6921f98de29946cab500e.tar.xz
frr-711915d2cdef4dcf41c6921f98de29946cab500e.zip
ripd: clear list of peers when RIP is deconfigured
This is an old standing bug where the list of RIP peers wasn't cleared after deconfiguring RIP, which caused the existing peers to still be present on a newly configured RIP instance (except when the timed out after ~3 minutes). Fix this. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ripd')
-rw-r--r--ripd/rip_peer.c6
-rw-r--r--ripd/ripd.c2
-rw-r--r--ripd/ripd.h1
3 files changed, 9 insertions, 0 deletions
diff --git a/ripd/rip_peer.c b/ripd/rip_peer.c
index ca3f25e94..07b295030 100644
--- a/ripd/rip_peer.c
+++ b/ripd/rip_peer.c
@@ -36,6 +36,7 @@ static struct rip_peer *rip_peer_new(void)
static void rip_peer_free(struct rip_peer *peer)
{
+ RIP_TIMER_OFF(peer->t_timeout);
XFREE(MTYPE_RIP_PEER, peer);
}
@@ -174,3 +175,8 @@ int rip_peer_list_cmp(struct rip_peer *p1, struct rip_peer *p2)
return (htonl(p1->addr.s_addr) < htonl(p2->addr.s_addr)) ? -1 : 1;
}
+
+void rip_peer_list_del(void *arg)
+{
+ rip_peer_free(arg);
+}
diff --git a/ripd/ripd.c b/ripd/ripd.c
index 49787db2b..a6cfd9b15 100644
--- a/ripd/ripd.c
+++ b/ripd/ripd.c
@@ -2609,6 +2609,7 @@ int rip_create(int socket)
rip->neighbor = route_table_init();
rip->peer_list = list_new();
rip->peer_list->cmp = (int (*)(void *, void *))rip_peer_list_cmp;
+ rip->peer_list->del = rip_peer_list_del;
rip->distance_table = route_table_init();
rip->distance_table->cleanup = rip_distance_table_node_cleanup;
rip->enable_interface = vector_init(1);
@@ -3288,6 +3289,7 @@ void rip_clean(void)
route_table_finish(rip->table);
route_table_finish(rip->neighbor);
+ list_delete(&rip->peer_list);
distribute_list_delete(&rip->distribute_ctx);
rip_clean_network();
diff --git a/ripd/ripd.h b/ripd/ripd.h
index 6936ad123..af0d3021a 100644
--- a/ripd/ripd.h
+++ b/ripd/ripd.h
@@ -449,6 +449,7 @@ extern void rip_peer_display(struct vty *);
extern struct rip_peer *rip_peer_lookup(struct in_addr *);
extern struct rip_peer *rip_peer_lookup_next(struct in_addr *);
extern int rip_peer_list_cmp(struct rip_peer *p1, struct rip_peer *p2);
+extern void rip_peer_list_del(void *arg);
extern void rip_info_free(struct rip_info *);
extern struct rip_distance *rip_distance_new(void);