Commit 49744103af for frr

commit 49744103affbfb68eace96e5dd39b2f78030df9d
Author: Philippe Guibert <philippe.guibert@6wind.com>
Date:   Tue Jun 16 17:16:51 2026 +0200

    isisd: add debug traces for missing router capability case

    There are cases where the router capability tlv is missing. This is the
    case with IPv6-capable only networks. Add some debugging traces for
    this.

    Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>

diff --git a/isisd/isis_sr.c b/isisd/isis_sr.c
index 3b3e2f8be7..fc5399c509 100644
--- a/isisd/isis_sr.c
+++ b/isisd/isis_sr.c
@@ -84,22 +84,30 @@ struct isis_sr_block *isis_sr_find_srgb(struct lspdb_head *lspdb, const uint8_t
 	struct isis_lsp *lsp0, *lsp;

 	lsp0 = isis_root_system_lsp(lspdb, sysid);
-	if (!lsp0)
+	if (!lsp0) {
+		sr_debug("%s: LSP not found for node %pSY", __func__, sysid);
 		return NULL;
-
+	}
 	if (lsp0->tlvs && lsp0->tlvs->router_cap && lsp0->tlvs->router_cap->srgb.range_size)
 		return &lsp0->tlvs->router_cap->srgb;

-	if (!lsp0->lspu.frags)
+	if (!lsp0->lspu.frags) {
+		sr_debug("%s: no LSP fragments found for node %pSY", __func__, sysid);
 		return NULL;
+	}

 	for (ALL_LIST_ELEMENTS_RO(lsp0->lspu.frags, node, lsp)) {
 		if (!lsp->tlvs || !lsp->tlvs->router_cap ||
-		    lsp->tlvs->router_cap->srgb.range_size == 0)
+		    lsp->tlvs->router_cap->srgb.range_size == 0) {
+			if (lsp->tlvs && lsp->tlvs->router_cap)
+				sr_debug("%s: Router capability found with SRGB range size of 0 for node %pSY",
+					 __func__, sysid);
 			continue;
+		}

 		return &lsp->tlvs->router_cap->srgb;
 	}
+	sr_debug("%s: No Router capability found for node %pSY", __func__, sysid);

 	return NULL;
 }
@@ -181,16 +189,21 @@ mpls_label_t sr_prefix_out_label(struct lspdb_head *lspdb, int family, struct is

 	/* Check that SID index falls inside the SRGB */
 	nh_srgb = isis_sr_find_srgb(lspdb, nh_sysid);
-	if (!nh_srgb)
+	if (!nh_srgb) {
+		zlog_warn("%s(): no SRGB received for %pSY", __func__, nh_sysid);
 		return MPLS_INVALID_LABEL;
+	}

 	/*
 	 * Check if the nexthop can handle SR-MPLS encapsulated IPv4 or
 	 * IPv6 packets.
 	 */
 	if ((family == AF_INET && !IS_SR_IPV4(nh_srgb)) ||
-	    (family == AF_INET6 && !IS_SR_IPV6(nh_srgb)))
+	    (family == AF_INET6 && !IS_SR_IPV6(nh_srgb))) {
+		zlog_warn("%s(): SRGB received for %pSY, but IPv%d disabled", __func__, nh_sysid,
+			  family == AF_INET ? 4 : 6);
 		return MPLS_INVALID_LABEL;
+	}

 	if (psid->value >= nh_srgb->range_size) {
 		flog_warn(EC_ISIS_SID_OVERFLOW, "%s: SID index %u falls outside remote SRGB range",