Skip to content

Commit

Permalink
zebra: Do not pathcount EVPN A-D prefixes
Browse files Browse the repository at this point in the history
With EVPN MH zebra is treating route adds as upsert
operations. However pathcounting these upserts would
lead to a never really decreasing counter. Route deletions
for EVPN MH should fully remove the dummy prefix from the
next-hop. Disabling increasing of the pathcount yields
the same behaviour for this type of route

Signed-off-by: Christopher Dziomba <[email protected]>
  • Loading branch information
chdxD1 committed Feb 15, 2025
1 parent f9ab5d8 commit de9f8c7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion zebra/zebra_evpn_mh.c
Original file line number Diff line number Diff line change
Expand Up @@ -3795,7 +3795,7 @@ void zebra_evpn_proc_remote_nh(ZAPI_HANDLER_ARGS)
memset(&dummy_prefix, 0, sizeof(dummy_prefix));
dummy_prefix.family = AF_EVPN;
dummy_prefix.prefixlen = (sizeof(struct evpn_addr) * 8);
dummy_prefix.prefix.route_type = 1; /* XXX - fixup to type-1 def */
dummy_prefix.prefix.route_type = BGP_EVPN_AD_ROUTE; /* XXX - fixup to type-1 def */
dummy_prefix.prefix.ead_addr.ip.ipa_type = nh.ipa_type;

if (hdr->command == ZEBRA_EVPN_REMOTE_NH_ADD) {
Expand Down
9 changes: 9 additions & 0 deletions zebra/zebra_vxlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,15 @@ static void rb_find_or_add_host(struct host_rb_tree_entry *hrbe,

hle = RB_FIND(host_rb_tree_entry, hrbe, &lookup);
if (hle) {
/* never pathcount evpn A-D / MH routes because zebra is not aware
* of specific paths. ADD operations are considered to be upsert
* leading to path count increasing without ever decreasing. A single
* DEL operation should fully remove the prefix from the next-hop.
*/
if (host->family == AF_EVPN
&& ((const struct prefix_evpn *)&host)->prefix.route_type == BGP_EVPN_AD_ROUTE)
return;

hle->pathcnt++;
return;
}
Expand Down

0 comments on commit de9f8c7

Please sign in to comment.