]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Fix SRv6 SID Manager
authorCarmine Scarpitta <cscarpit@cisco.com>
Thu, 30 Jan 2025 18:25:57 +0000 (19:25 +0100)
committerCarmine Scarpitta <cscarpit@cisco.com>
Thu, 30 Jan 2025 18:28:34 +0000 (19:28 +0100)
The SRv6 SID Manager does not allow allocating an SRv6 End/uN function
even though it is already supported by staticd.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
zebra/zebra_srv6.c

index 624f60e815af668c227d01ce94f6d36c69238c7f..6d228c5e24f349dcb52474531e3a2e3cd7425e96 100644 (file)
@@ -1547,9 +1547,26 @@ static int get_srv6_sid_explicit(struct zebra_srv6_sid **sid,
        }
 
        if (ctx->behavior == ZEBRA_SEG6_LOCAL_ACTION_END) {
-               zlog_err("%s: invalid SM request arguments: explicit SID allocation not allowed for End/uN behavior",
-                        __func__);
-               return -1;
+               zctx = zebra_srv6_sid_ctx_alloc();
+               zctx->ctx = *ctx;
+
+               *sid = zebra_srv6_sid_alloc(zctx, sid_value, locator, block, sid_func,
+                                           SRV6_SID_ALLOC_MODE_EXPLICIT);
+               if (!(*sid)) {
+                       flog_err(EC_ZEBRA_SM_CANNOT_ASSIGN_SID,
+                                "%s: failed to create SRv6 SID %s (%pI6)", __func__,
+                                srv6_sid_ctx2str(buf, sizeof(buf), ctx), sid_value);
+                       return -1;
+               }
+               (*sid)->ctx = zctx;
+               zctx->sid = *sid;
+               listnode_add(srv6->sids, zctx);
+
+               if (IS_ZEBRA_DEBUG_SRV6)
+                       zlog_debug("%s: allocated explicit SRv6 SID %pI6 for context %s", __func__,
+                                  &(*sid)->value, srv6_sid_ctx2str(buf, sizeof(buf), ctx));
+
+               return 1;
        }
 
        /* Allocate an explicit SID function for the SID */