-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FRR] Fixing zebra to handle non notification of better admin won (#1…
…7184) * [FRR]Fixing zebra to handle non notification of better admin won * Updating the patch with latest changes from FRR
- Loading branch information
1 parent
aa8a540
commit 35993c9
Showing
2 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
src/sonic-frr/patch/0027-zebra-Fix-non-notification-of-better-admin-won.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
From 41b759505afb261211f40e386a30f6cf3870a094 Mon Sep 17 00:00:00 2001 | ||
From: dgsudharsan <[email protected]> | ||
Date: Tue, 21 Nov 2023 17:55:24 +0000 | ||
Subject: [PATCH] zebra: Fix non-notification of better admin won If there | ||
happens to be a entry in the zebra rib that has a lower admin distance then a | ||
newly received re, zebra would not notify the upper level protocol about this | ||
happening. Imagine a case where there is a connected route for say a /32 and | ||
bgp receives a route from a peer that is the same route as the connected. | ||
Since BGP has no network statement and perceives the route as being `good` | ||
bgp will install the route into zebra. Zebra will look at the new bgp re and | ||
correctly identify that the re is not something that it will use and do | ||
nothing. This change notices this and sends up a BETTER_ADMIN_WON route | ||
notification. | ||
|
||
|
||
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c | ||
index 039c44cc09..f2f20bcf7b 100644 | ||
--- a/zebra/zebra_rib.c | ||
+++ b/zebra/zebra_rib.c | ||
@@ -1209,6 +1209,7 @@ static void rib_process(struct route_node *rn) | ||
rib_dest_t *dest; | ||
struct zebra_vrf *zvrf = NULL; | ||
struct vrf *vrf; | ||
+ struct route_entry *proto_re_changed = NULL; | ||
|
||
vrf_id_t vrf_id = VRF_UNKNOWN; | ||
|
||
@@ -1278,6 +1279,7 @@ static void rib_process(struct route_node *rn) | ||
* skip it. | ||
*/ | ||
if (CHECK_FLAG(re->status, ROUTE_ENTRY_CHANGED)) { | ||
+ proto_re_changed = re; | ||
if (!nexthop_active_update(rn, re)) { | ||
const struct prefix *p; | ||
struct rib_table_info *info; | ||
@@ -1363,6 +1365,8 @@ static void rib_process(struct route_node *rn) | ||
* new_selected --- RE entry that is newly SELECTED | ||
* old_fib --- RE entry currently in kernel FIB | ||
* new_fib --- RE entry that is newly to be in kernel FIB | ||
+ * proto_re_changed -- RE that is the last changed entry in the | ||
+ * list of RE's. | ||
* | ||
* new_selected will get SELECTED flag, and is going to be redistributed | ||
* the zclients. new_fib (which can be new_selected) will be installed | ||
@@ -1417,6 +1421,22 @@ static void rib_process(struct route_node *rn) | ||
} | ||
} | ||
|
||
+ /* | ||
+ * If zebra has a new_selected and a proto_re_changed | ||
+ * entry that was not the old selected and the protocol | ||
+ * is different, zebra should notify the upper level | ||
+ * protocol that the sent down entry was not selected | ||
+ */ | ||
+ if (new_selected && proto_re_changed && | ||
+ proto_re_changed != old_selected && | ||
+ new_selected->type != proto_re_changed->type) { | ||
+ struct rib_table_info *info = srcdest_rnode_table_info(rn); | ||
+ | ||
+ zsend_route_notify_owner(rn, proto_re_changed, | ||
+ ZAPI_ROUTE_BETTER_ADMIN_WON, info->afi, | ||
+ info->safi); | ||
+ } | ||
+ | ||
/* Update fib according to selection results */ | ||
if (new_fib && old_fib) | ||
rib_process_update_fib(zvrf, rn, old_fib, new_fib); | ||
-- | ||
2.17.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters