Skip to content

Commit 4718791

Browse files
author
Trey Aspelund
committed
lib: fix handling of rmap prefix-tree default node
Prior to this commit, updating a prefix-list that is referenced by a route-map clause will unconditionally delete the root node of that route-map's prefix-tree (used with route-map optimization). This is problematic because routes not matching a more specific node in the tree (i.e. other prefix-list sequences) will not fall-back to the default node, thus they will not hit any route-map sequences. This commit ensures that an update to a prefix-list will only delete the default node while adding the first/only seq to the list. Example config: ======== ip prefix-list peer475-out-pfxlist seq 45 permit 2.138.0.0/16 ip prefix-list peer475-out-pfxlist seq 50 permit 0.0.0.0/0 ! route-map peer475-out permit 5 match ip address prefix-list peer475-out-pfxlist Before: ======== ub20# do show route-map peer475-out prefix-table ZEBRA: IPv4 Prefix Route-map Index List _______________ ____________________ 0.0.0.0/0 (2) (P) peer475-out seq 5 2.138.0.0/16 (2) (P) 0.0.0.0/0 peer475-out seq 5 IPv6 Prefix Route-map Index List _______________ ____________________ BGP: IPv4 Prefix Route-map Index List _______________ ____________________ 0.0.0.0/0 (2) (P) peer475-out seq 5 2.138.0.0/16 (2) (P) 0.0.0.0/0 peer475-out seq 5 IPv6 Prefix Route-map Index List _______________ ____________________ ub20# conf t ub20(config)# ip prefix-list peer475-out-pfxlist seq 45 permit 2.138.0.0/16 le 32 ub20(config)# do show route-map peer475-out prefix-table ZEBRA: IPv4 Prefix Route-map Index List _______________ ____________________ 2.138.0.0/16 (2) (P) peer475-out seq 5 IPv6 Prefix Route-map Index List _______________ ____________________ BGP: IPv4 Prefix Route-map Index List _______________ ____________________ 2.138.0.0/16 (2) (P) peer475-out seq 5 IPv6 Prefix Route-map Index List _______________ ____________________ ub20(config)# After: ======== ub20(config)# do show route-map peer475-out prefix-table ZEBRA: IPv4 Prefix Route-map Index List _______________ ____________________ 0.0.0.0/0 (2) (P) peer475-out seq 5 2.138.0.0/16 (2) (P) 0.0.0.0/0 peer475-out seq 5 IPv6 Prefix Route-map Index List _______________ ____________________ BGP: IPv4 Prefix Route-map Index List _______________ ____________________ 0.0.0.0/0 (2) (P) peer475-out seq 5 2.138.0.0/16 (2) (P) 0.0.0.0/0 peer475-out seq 5 IPv6 Prefix Route-map Index List _______________ ____________________ ub20(config)# ip prefix-list peer475-out-pfxlist seq 45 permit 2.138.0.0/16 le 32 ub20(config)# do show route-map peer475-out prefix-table ZEBRA: IPv4 Prefix Route-map Index List _______________ ____________________ 0.0.0.0/0 (2) (P) peer475-out seq 5 2.138.0.0/16 (2) (P) 0.0.0.0/0 peer475-out seq 5 IPv6 Prefix Route-map Index List _______________ ____________________ BGP: IPv4 Prefix Route-map Index List _______________ ____________________ 0.0.0.0/0 (2) (P) peer475-out seq 5 2.138.0.0/16 (2) (P) 0.0.0.0/0 peer475-out seq 5 IPv6 Prefix Route-map Index List _______________ ____________________ ub20(config)# Fixes: 8410 Signed-off-by: Trey Aspelund <[email protected]>
1 parent 80b82d5 commit 4718791

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/routemap.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -1982,7 +1982,15 @@ static void route_map_add_plist_entries(afi_t afi,
19821982
return;
19831983
}
19841984

1985-
route_map_pfx_table_del_default(afi, index);
1985+
/* Default entry should be deleted only if the first entry of the
1986+
* prefix-list is created.
1987+
*/
1988+
if (entry) {
1989+
if (plist->count == 1)
1990+
route_map_pfx_table_del_default(afi, index);
1991+
} else {
1992+
route_map_pfx_table_del_default(afi, index);
1993+
}
19861994

19871995
if (entry) {
19881996
if (afi == AFI_IP) {

0 commit comments

Comments
 (0)