]> git.puffer.fish Git - matthieu/frr.git/commitdiff
staticd: Extend `static_zebra_release_srv6_sid` to release SRv6 uA SIDs
authorCarmine Scarpitta <cscarpit@cisco.com>
Thu, 13 Feb 2025 10:02:23 +0000 (11:02 +0100)
committerCarmine Scarpitta <cscarpit@cisco.com>
Wed, 26 Feb 2025 06:19:51 +0000 (07:19 +0100)
When removing an SRv6 uA SID, staticd should ask SRv6 SID Manager to
release the SID.
Currently, `static_zebra_release_srv6_sid` does not allow to release uA
SIDs.

This commit extends `static_zebra_release_srv6_sid` to allow staticd to
release SRv6 uA SIDs.

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

index d3ff5ee45f70b7ee3ae55cb7236574443bc1614d..ec425a4afcd4e363e77f730a647dc0b9994f1c2a 100644 (file)
@@ -977,6 +977,7 @@ extern void static_zebra_release_srv6_sid(struct static_srv6_sid *sid)
        struct srv6_sid_ctx ctx = {};
        struct vrf *vrf;
        int ret = 0;
+       struct interface *ifp;
 
        if (!sid || !CHECK_FLAG(sid->flags, STATIC_FLAG_SRV6_SID_VALID))
                return;
@@ -1027,13 +1028,23 @@ extern void static_zebra_release_srv6_sid(struct static_srv6_sid *sid)
                        ctx.vrf_id = vrf->vrf_id;
                }
 
+               break;
+       case SRV6_ENDPOINT_BEHAVIOR_END_X_NEXT_CSID:
+               ctx.behavior = ZEBRA_SEG6_LOCAL_ACTION_END_X;
+               ctx.nh6 = sid->attributes.nh6;
+               ifp = if_lookup_by_name(sid->attributes.ifname, VRF_DEFAULT);
+               if (!ifp) {
+                       zlog_warn("Failed to request SRv6 SID %pFX: interface %s does not exist",
+                                 &sid->addr, sid->attributes.ifname);
+                       return;
+               }
+               ctx.ifindex = ifp->ifindex;
                break;
        case SRV6_ENDPOINT_BEHAVIOR_END_PSP_USD:
        case SRV6_ENDPOINT_BEHAVIOR_END_NEXT_CSID_PSP_USD:
        case SRV6_ENDPOINT_BEHAVIOR_END_X:
        case SRV6_ENDPOINT_BEHAVIOR_END_X_PSP:
        case SRV6_ENDPOINT_BEHAVIOR_END_X_PSP_USD:
-       case SRV6_ENDPOINT_BEHAVIOR_END_X_NEXT_CSID:
        case SRV6_ENDPOINT_BEHAVIOR_END_X_NEXT_CSID_PSP:
        case SRV6_ENDPOINT_BEHAVIOR_END_X_NEXT_CSID_PSP_USD:
        case SRV6_ENDPOINT_BEHAVIOR_OPAQUE: