summaryrefslogtreecommitdiff
path: root/zebra/zebra_rib.c
diff options
context:
space:
mode:
authorMark Stapp <mjs.ietf@gmail.com>2023-12-07 08:30:00 -0500
committerGitHub <noreply@github.com>2023-12-07 08:30:00 -0500
commit2648661ed50dd223a1c354bb85a67b762e5a1344 (patch)
treeea81ac72c319baaf8f78594cdde0c67f30cb9938 /zebra/zebra_rib.c
parent24869b4a9998a7771638a0c7b0df789fd09f7886 (diff)
parent2d3005068c10e38b32448ef8acf89a0b67ab4276 (diff)
Merge pull request #14795 from donaldsharp/zebra_notify_admin_lost
zebra: Fix non-notification of better admin won
Diffstat (limited to 'zebra/zebra_rib.c')
-rw-r--r--zebra/zebra_rib.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index af94adf05a..0bcb21fd74 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -1233,6 +1233,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;
@@ -1302,6 +1303,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;
@@ -1387,6 +1389,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
@@ -1441,6 +1445,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);