Merge pull request #4162 from opensourcerouting/rip-issues

ripd, ripngd: fix cleaning up of offset lists
This commit is contained in:
Donald Sharp 2019-04-23 08:34:47 -04:00 committed by GitHub
commit c1f0465a3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 2 deletions

View File

@ -291,6 +291,7 @@ int config_write_if_rmap(struct vty *vty,
void if_rmap_ctx_delete(struct if_rmap_ctx *ctx)
{
listnode_delete(if_rmap_ctx_list, ctx);
hash_clean(ctx->ifrmaphash, (void (*)(void *))if_rmap_free);
if (ctx->name)
XFREE(MTYPE_IF_RMAP_CTX_NAME, ctx);

View File

@ -50,6 +50,11 @@ struct rip_offset_list *rip_offset_list_new(struct rip *rip, const char *ifname)
void offset_list_del(struct rip_offset_list *offset)
{
listnode_delete(offset->rip->offset_list_master, offset);
offset_list_free(offset);
}
void offset_list_free(struct rip_offset_list *offset)
{
if (OFFSET_LIST_IN_NAME(offset))
free(OFFSET_LIST_IN_NAME(offset));
if (OFFSET_LIST_OUT_NAME(offset))

View File

@ -2712,7 +2712,7 @@ struct rip *rip_create(const char *vrf_name, struct vrf *vrf, int socket)
rip->passive_nondefault = vector_init(1);
rip->offset_list_master = list_new();
rip->offset_list_master->cmp = (int (*)(void *, void *))offset_list_cmp;
rip->offset_list_master->del = (void (*)(void *))offset_list_del;
rip->offset_list_master->del = (void (*)(void *))offset_list_free;
/* Distribute list install. */
rip->distribute_ctx = distribute_list_ctx_create(vrf);

View File

@ -507,6 +507,7 @@ extern struct rip_info *rip_ecmp_delete(struct rip *rip,
extern struct rip_offset_list *rip_offset_list_new(struct rip *rip,
const char *ifname);
extern void offset_list_del(struct rip_offset_list *offset);
extern void offset_list_free(struct rip_offset_list *offset);
extern struct rip_offset_list *rip_offset_list_lookup(struct rip *rip,
const char *ifname);
extern int rip_offset_list_apply_in(struct prefix_ipv4 *, struct interface *,

View File

@ -56,6 +56,11 @@ struct ripng_offset_list *ripng_offset_list_new(struct ripng *ripng,
void ripng_offset_list_del(struct ripng_offset_list *offset)
{
listnode_delete(offset->ripng->offset_list_master, offset);
ripng_offset_list_free(offset);
}
void ripng_offset_list_free(struct ripng_offset_list *offset)
{
if (OFFSET_LIST_IN_NAME(offset))
free(OFFSET_LIST_IN_NAME(offset));
if (OFFSET_LIST_OUT_NAME(offset))

View File

@ -1889,7 +1889,7 @@ struct ripng *ripng_create(const char *vrf_name, struct vrf *vrf, int socket)
ripng->offset_list_master->cmp =
(int (*)(void *, void *))offset_list_cmp;
ripng->offset_list_master->del =
(void (*)(void *))ripng_offset_list_del;
(void (*)(void *))ripng_offset_list_free;
ripng->distribute_ctx = distribute_list_ctx_create(vrf);
distribute_list_add_hook(ripng->distribute_ctx,
ripng_distribute_update);

View File

@ -421,6 +421,7 @@ extern void ripng_peer_list_del(void *arg);
extern struct ripng_offset_list *ripng_offset_list_new(struct ripng *ripng,
const char *ifname);
extern void ripng_offset_list_del(struct ripng_offset_list *offset);
extern void ripng_offset_list_free(struct ripng_offset_list *offset);
extern struct ripng_offset_list *ripng_offset_list_lookup(struct ripng *ripng,
const char *ifname);
extern int ripng_offset_list_apply_in(struct ripng *ripng,