]> git.puffer.fish Git - mirror/frr.git/commit
lib: Delete the entire access-list only if there are no more entries 6315/head
authorDonatas Abraitis <donatas.abraitis@gmail.com>
Mon, 27 Apr 2020 09:13:48 +0000 (12:13 +0300)
committerDonatas Abraitis <donatas.abraitis@gmail.com>
Wed, 29 Apr 2020 14:25:29 +0000 (17:25 +0300)
commitf822435cf52d6548e1c4b1adad37de4d9d024061
treea30ed61baa638da101b7cb7a3131b5944306d074
parentf99bb6a0fe6a715920de208ff213aaeac88b23a7
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