diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2020-04-29 08:31:31 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-29 08:31:31 -0400 |
| commit | cd8e0b88e3bae2efd65b9a2cc3464beabb6a6969 (patch) | |
| tree | e3edec930df225ac9edeb1a62df48bdb9587f66a | |
| parent | f6be73082788c4be246b9b71f50237bbad40bfc8 (diff) | |
| parent | 7d16d76f4c5628aefd104d1a5bc97b1829a375e7 (diff) | |
Merge pull request #6299 from ton31337/fix/access-list_deletion
lib: Delete the entire access-list only if there are no more entries
| -rw-r--r-- | lib/filter.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/filter.c b/lib/filter.c index da02a77763..4a83b8b043 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -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); } |
