Commit 744b3f1118 for frr
commit 744b3f1118518baf8d152ff52a21647de4766e0b
Author: Philippe Guibert <philippe.guibert@6wind.com>
Date: Fri Dec 4 17:35:32 2026 +0100
Revert "zebra: do not keep an SR policy pointer to a freed LSP"
This reverts commit 6fd835e1abd8df6acc70f3a68b2edb016dcc2f5a.
diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c
index fbcdfe171b..f4c72e250a 100644
--- a/zebra/zebra_mpls.c
+++ b/zebra/zebra_mpls.c
@@ -1217,7 +1217,6 @@ static void lsp_free(struct hash *lsp_table, struct zebra_lsp **plsp)
lsp_free_nhlfe(lsp);
- zebra_sr_policy_lsp_freed(lsp);
hash_release(lsp_table, &lsp->ile);
XFREE(MTYPE_LSP, lsp);
@@ -4084,7 +4083,6 @@ static void lsp_table_free(void *p)
lsp_free_nhlfe(lsp);
- zebra_sr_policy_lsp_freed(lsp);
XFREE(MTYPE_LSP, lsp);
}
diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c
index 7d3ef85407..d0eac28055 100644
--- a/zebra/zebra_nhg.c
+++ b/zebra/zebra_nhg.c
@@ -2762,7 +2762,7 @@ static int nexthop_active(struct nexthop *nexthop, struct nhg_hash_entry *nhe,
}
policy = zebra_sr_policy_find(nexthop->srte_color, &endpoint);
- if (policy && policy->status == ZEBRA_SR_POLICY_UP && policy->lsp) {
+ if (policy && policy->status == ZEBRA_SR_POLICY_UP) {
resolved = 0;
frr_each_safe (nhlfe_list, &policy->lsp->nhlfe_list,
nhlfe) {
diff --git a/zebra/zebra_srte.c b/zebra/zebra_srte.c
index 76813e0ea8..150cb4e64c 100644
--- a/zebra/zebra_srte.c
+++ b/zebra/zebra_srte.c
@@ -12,7 +12,6 @@
#include "zebra/zebra_mpls.h"
#include "zebra/zebra_rnh.h"
#include "zebra/zapi_msg.h"
-#include "zebra/zebra_router.h"
DEFINE_MTYPE_STATIC(ZEBRA, ZEBRA_SR_POLICY, "SR Policy");
@@ -98,9 +97,6 @@ static int zebra_sr_policy_notify_update_client(struct zebra_sr_policy *policy,
struct zapi_nexthop znh;
int ret;
- if (!policy->lsp)
- return 0;
-
/* Get output stream. */
s = stream_new(ZEBRA_MAX_PACKET_SIZ);
@@ -356,7 +352,7 @@ int zebra_sr_policy_bsid_install(struct zebra_sr_policy *policy)
struct zapi_srte_tunnel *zt = &policy->segment_list;
struct zebra_nhlfe *nhlfe;
- if (zt->local_label == MPLS_LABEL_NONE || !policy->lsp)
+ if (zt->local_label == MPLS_LABEL_NONE)
return 0;
frr_each_safe (nhlfe_list, &policy->lsp->nhlfe_list, nhlfe) {
@@ -407,38 +403,6 @@ void zebra_sr_policy_bsid_uninstall(struct zebra_sr_policy *policy,
mpls_lsp_uninstall_all_vrf(policy->zvrf, zt->type, old_bsid);
}
-static struct event *t_sr_policy_revalidate;
-
-/* Revalidate the policies whose LSP was freed, from the event loop. */
-static void zebra_sr_policy_revalidate(struct event *thread)
-{
- struct zebra_sr_policy *policy, *policy_temp;
-
- RB_FOREACH_SAFE (policy, zebra_sr_policy_instance_head, &zebra_sr_policy_instances,
- policy_temp) {
- if (policy->status == ZEBRA_SR_POLICY_UP && !policy->lsp)
- zebra_sr_policy_validate(policy, NULL);
- }
-}
-
-/* The LSP is about to be freed: drop any SR policy pointer to it. */
-void zebra_sr_policy_lsp_freed(const struct zebra_lsp *lsp)
-{
- struct zebra_sr_policy *policy;
- bool found = false;
-
- RB_FOREACH (policy, zebra_sr_policy_instance_head, &zebra_sr_policy_instances) {
- if (policy->lsp != lsp)
- continue;
- policy->lsp = NULL;
- found = true;
- }
-
- if (found)
- event_add_event(zrouter.master, zebra_sr_policy_revalidate, NULL, 0,
- &t_sr_policy_revalidate);
-}
-
int zebra_sr_policy_label_update(mpls_label_t label,
enum zebra_sr_policy_update_label_mode mode)
{
diff --git a/zebra/zebra_srte.h b/zebra/zebra_srte.h
index f599344902..8c5ecca8dc 100644
--- a/zebra/zebra_srte.h
+++ b/zebra/zebra_srte.h
@@ -53,7 +53,6 @@ int zebra_sr_policy_bsid_install(struct zebra_sr_policy *policy);
void zebra_sr_policy_bsid_uninstall(struct zebra_sr_policy *policy,
mpls_label_t old_bsid);
void zebra_srte_init(void);
-void zebra_sr_policy_lsp_freed(const struct zebra_lsp *lsp);
int zebra_sr_policy_label_update(mpls_label_t label,
enum zebra_sr_policy_update_label_mode mode);