mirror of
				https://git.proxmox.com/git/mirror_frr
				synced 2025-11-04 01:43:38 +00:00 
			
		
		
		
	pimd: Cleanup the deletion event a tiny bit
The pim_upstream_free command was leaving slag by not deleting data associated with the upstream data structure. Modify the code to explicitly free all data associated with an upstream on a pim instance deletion event. Additionally the end result is that the pim_upstream_free command is not needed anymore Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
		
							parent
							
								
									5456d3b844
								
							
						
					
					
						commit
						172e45dc30
					
				@ -140,12 +140,6 @@ static struct pim_upstream *pim_upstream_find_parent(struct pim_instance *pim,
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void pim_upstream_free(struct pim_upstream *up)
 | 
			
		||||
{
 | 
			
		||||
	XFREE(MTYPE_PIM_UPSTREAM, up);
 | 
			
		||||
	up = NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void upstream_channel_oil_detach(struct pim_upstream *up)
 | 
			
		||||
{
 | 
			
		||||
	if (up->channel_oil) {
 | 
			
		||||
@ -209,11 +203,6 @@ struct pim_upstream *pim_upstream_del(struct pim_instance *pim,
 | 
			
		||||
 | 
			
		||||
	list_delete_and_null(&up->ifchannels);
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	  notice that listnode_delete() can't be moved
 | 
			
		||||
	  into pim_upstream_free() because the later is
 | 
			
		||||
	  called by list_delete_all_node()
 | 
			
		||||
	*/
 | 
			
		||||
	if (up->parent && up->parent->sources)
 | 
			
		||||
		listnode_delete(up->parent->sources, up);
 | 
			
		||||
	up->parent = NULL;
 | 
			
		||||
@ -237,7 +226,7 @@ struct pim_upstream *pim_upstream_del(struct pim_instance *pim,
 | 
			
		||||
	}
 | 
			
		||||
	pim_delete_tracked_nexthop(pim, &nht_p, up, NULL);
 | 
			
		||||
 | 
			
		||||
	pim_upstream_free(up);
 | 
			
		||||
	XFREE(MTYPE_PIM_UPSTREAM, up);
 | 
			
		||||
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
@ -1545,8 +1534,15 @@ unsigned int pim_upstream_hash_key(void *arg)
 | 
			
		||||
 | 
			
		||||
void pim_upstream_terminate(struct pim_instance *pim)
 | 
			
		||||
{
 | 
			
		||||
	if (pim->upstream_list)
 | 
			
		||||
	struct listnode *node, *nnode;
 | 
			
		||||
	struct pim_upstream *up;
 | 
			
		||||
 | 
			
		||||
	if (pim->upstream_list) {
 | 
			
		||||
		for (ALL_LIST_ELEMENTS(pim->upstream_list, node, nnode, up))
 | 
			
		||||
			pim_upstream_del(pim, up, __PRETTY_FUNCTION__);
 | 
			
		||||
 | 
			
		||||
		list_delete_and_null(&pim->upstream_list);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (pim->upstream_hash)
 | 
			
		||||
		hash_free(pim->upstream_hash);
 | 
			
		||||
@ -1773,6 +1769,5 @@ void pim_upstream_init(struct pim_instance *pim)
 | 
			
		||||
					      pim_upstream_equal, hash_name);
 | 
			
		||||
 | 
			
		||||
	pim->upstream_list = list_new();
 | 
			
		||||
	pim->upstream_list->del = (void (*)(void *))pim_upstream_free;
 | 
			
		||||
	pim->upstream_list->cmp = pim_upstream_compare;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -137,7 +137,6 @@ struct pim_upstream {
 | 
			
		||||
	int64_t state_transition; /* Record current state uptime */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void pim_upstream_free(struct pim_upstream *up);
 | 
			
		||||
struct pim_upstream *pim_upstream_find(struct pim_instance *pim,
 | 
			
		||||
				       struct prefix_sg *sg);
 | 
			
		||||
struct pim_upstream *pim_upstream_find_or_add(struct prefix_sg *sg,
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user