mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-17 08:23:39 +00:00
Merge pull request #6299 from ton31337/fix/access-list_deletion
lib: Delete the entire access-list only if there are no more entries
This commit is contained in:
commit
cd8e0b88e3
@ -437,12 +437,12 @@ static struct filter *filter_seq_check(struct access_list *access,
|
||||
}
|
||||
|
||||
/* If access_list has no filter then return 1. */
|
||||
static int access_list_empty(struct access_list *access)
|
||||
static bool access_list_empty(struct access_list *access)
|
||||
{
|
||||
if (access->head == NULL && access->tail == NULL)
|
||||
return 1;
|
||||
return true;
|
||||
else
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Delete filter from specified access_list. If there is hook
|
||||
@ -451,6 +451,7 @@ static void access_list_filter_delete(struct access_list *access,
|
||||
struct filter *filter)
|
||||
{
|
||||
struct access_master *master;
|
||||
struct filter *replace = filter;
|
||||
|
||||
master = access->master;
|
||||
|
||||
@ -472,7 +473,7 @@ static void access_list_filter_delete(struct access_list *access,
|
||||
(*master->delete_hook)(access);
|
||||
|
||||
/* If access_list becomes empty delete it from access_master. */
|
||||
if (access_list_empty(access))
|
||||
if (access_list_empty(access) && !replace)
|
||||
access_list_delete(access);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user