]> git.proxmox.com Git - mirror_frr.git/commit
lib: Delete the entire access-list only if there are no more entries
authorDonatas Abraitis <donatas.abraitis@gmail.com>
Mon, 27 Apr 2020 09:13:48 +0000 (12:13 +0300)
committerDonatas Abraitis <donatas.abraitis@gmail.com>
Mon, 27 Apr 2020 09:13:48 +0000 (12:13 +0300)
commit7d16d76f4c5628aefd104d1a5bc97b1829a375e7
tree6b7f828cfc8907d7988eba24a896e4d9c3335693
parent7351b9575423b665829fdaca76e0ffbbdf4e829e
lib: Delete the entire access-list only if there are no more entries

When you enter the access-list with the same sequence number but with a
different prefix AND access-list has only a single entry, then the entry
is deleted and the whole access-list is deleted.

That means that "replace entry" never be re-inserted.

With fix:
```
~# vtysh -c 'c' -c 'access-list 1 seq 10 permit 127.0.0.10/32'
~# vtysh -c 'sh run' | grep access-list
access-list 1 seq 10 permit 127.0.0.10/32
~# vtysh -c 'c' -c 'access-list 1 seq 10 permit 127.0.0.20/32'
~# vtysh -c 'sh run' | grep access-list
access-list 1 seq 10 permit 127.0.0.20/32
~# vtysh -c 'c' -c 'access-list 1 seq 11 permit 127.0.0.11/32'
~# vtysh -c 'sh run' | grep access-list
access-list 1 seq 10 permit 127.0.0.20/32
access-list 1 seq 11 permit 127.0.0.11/32
~# vtysh -c 'c' -c 'no access-list 1 seq 10 permit 127.0.0.20/32'
~# vtysh -c 'sh run' | grep access-list
access-list 1 seq 11 permit 127.0.0.11/32
~#
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
lib/filter.c