Skip to content

Commit

Permalink
lib: Take ge/le into consideration when checking the prefix with the …
Browse files Browse the repository at this point in the history
…prefix-list

Without the fix:

```
show ip prefix-list test_1 10.20.30.96/27 first-match
 <no result>

show ip prefix-list test_2 192.168.1.2/32 first-match
 <no result>
```

With the fix:

```
ip prefix-list test_1 seq 10 permit 10.20.30.64/26 le 27
!
end
donatas# show ip prefix-list test_1 10.20.30.96/27
   seq 10 permit 10.20.30.64/26 le 27 (hit count: 1, refcount: 0)
donatas# show ip prefix-list test_1 10.20.30.64/27
   seq 10 permit 10.20.30.64/26 le 27 (hit count: 2, refcount: 0)
donatas# show ip prefix-list test_1 10.20.30.64/28
donatas# show ip prefix-list test_1 10.20.30.126/26
   seq 10 permit 10.20.30.64/26 le 27 (hit count: 3, refcount: 0)
donatas# show ip prefix-list test_1 10.20.30.126/30
donatas#
```

Signed-off-by: Donatas Abraitis <[email protected]>
(cherry picked from commit dd4c2ac)
  • Loading branch information
ton31337 authored and mergify[bot] committed Dec 17, 2024
1 parent 5af15b0 commit 9df9417
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/plist.c
Original file line number Diff line number Diff line change
Expand Up @@ -1140,8 +1140,10 @@ static int vty_show_prefix_list_prefix(struct vty *vty, afi_t afi,
match = 0;

if (type == normal_display || type == first_match_display)
if (prefix_same(&p, &pentry->prefix))
if (prefix_list_entry_match(pentry, &p, false)) {
pentry->hitcnt++;
match = 1;
}

if (type == longer_display) {
if ((p.family == pentry->prefix.family)
Expand Down

0 comments on commit 9df9417

Please sign in to comment.