]> git.puffer.fish Git - matthieu/frr.git/commitdiff
staticd: Fix wrong xpath in `no sid X:X::X:X/M`
authorCarmine Scarpitta <cscarpit@cisco.com>
Mon, 3 Feb 2025 11:56:02 +0000 (12:56 +0100)
committerCarmine Scarpitta <cscarpit@cisco.com>
Mon, 3 Feb 2025 21:33:00 +0000 (22:33 +0100)
When a user wants to delete a specific SRv6 SID, he executes the
`no sid X:X::X:X/M` command.
However, by mistake, in addition to deleting the SID requested by the
user, this command also removes all other SIDs.

This happens because `no sid X:X::X:X/M` triggers a destroy operation
on the wrong xpath `frr-staticd:staticd/segment-routing/srv6`.

This commit fixes the issue by replacing the wrong xpath
`frr-staticd:staticd/segment-routing/srv6` with the correct xpath
`frr-staticd:staticd/segment-routing/srv6/static-sids/sid[sid='%s']`.

This ensures that the `no sid X:X::X:X/M` command only deletes the SID
that was requested by the user.

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

index ed2805d3eab95b61edc7db78a1d947972fc4214e..f93e81e8dc057efc2ab27ff87053d7331c7f5ea4 100644 (file)
@@ -1273,8 +1273,8 @@ DEFPY_YANG(no_srv6_sid, no_srv6_sid_cmd,
 {
        char xpath[XPATH_MAXLEN + 37];
 
-       snprintf(xpath, sizeof(xpath), FRR_STATIC_SRV6_INFO_KEY_XPATH, "frr-staticd:staticd",
-                "staticd", VRF_DEFAULT_NAME);
+       snprintf(xpath, sizeof(xpath), FRR_STATIC_SRV6_SID_KEY_XPATH, "frr-staticd:staticd",
+                "staticd", VRF_DEFAULT_NAME, sid_str);
 
        nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);