]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ripdng: clear list of peers when RIPng is deconfigured
authorRenato Westphal <renato@opensourcerouting.org>
Fri, 4 Jan 2019 21:08:10 +0000 (19:08 -0200)
committerRenato Westphal <renato@opensourcerouting.org>
Fri, 18 Jan 2019 18:15:41 +0000 (16:15 -0200)
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>
ripngd/ripng_peer.c
ripngd/ripngd.c
ripngd/ripngd.h

index f5590cf823ffa91a95f86704d920c86d6f65adf5..36c701b86bf81ce8bdb62f66c09fcb280bae52f1 100644 (file)
@@ -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);
+}
index 2cc3bd7f1e8fbc9922da96560242c944a5519d47..9456980e87d7e968fea40aaeadaa21ad601f0b03 100644 (file)
@@ -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);
index 3e5ca18ed2396cf9489790a46c6becba055d6819..26b6c0bb12bf5d59f92d11fb29481cb0228e0f82 100644 (file)
@@ -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);