summaryrefslogtreecommitdiff
path: root/lib/srv6.c
diff options
context:
space:
mode:
authorCarmine Scarpitta <cscarpit@cisco.com>2025-02-08 22:17:09 +0100
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2025-02-13 18:38:17 +0000
commit2a23344123ccd31c373c7157fc0545938b192eb9 (patch)
treecde147ab97735b50b6840554ffd07a74d0e9f77b /lib/srv6.c
parentfce911649bb656a174cc2d47c708a548d5b6676f (diff)
lib: Add sidStructure in SRv6 SIDs JSON output
The `show ipv6 route json` command displays the IPv6 routing table in JSON format, including SRv6 SIDs. For each SRv6 SID, it provides behavior and SID attributes. However, it does not include the SID structure. This commit adds the SID structure to the SRv6 SID JSON output. Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com> (cherry picked from commit 312f7b3f8c7382afef6993aa2110326db2327c35)
Diffstat (limited to 'lib/srv6.c')
-rw-r--r--lib/srv6.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/srv6.c b/lib/srv6.c
index e6fc375fbb..c00aca3cab 100644
--- a/lib/srv6.c
+++ b/lib/srv6.c
@@ -71,6 +71,14 @@ int snprintf_seg6_segs(char *str,
return strlen(str);
}
+void srv6_sid_structure2json(const struct seg6local_context *ctx, json_object *json)
+{
+ json_object_int_add(json, "blockLen", ctx->block_len);
+ json_object_int_add(json, "nodeLen", ctx->node_len);
+ json_object_int_add(json, "funcLen", ctx->function_len);
+ json_object_int_add(json, "argLen", ctx->argument_len);
+}
+
void seg6local_context2json(const struct seg6local_context *ctx,
uint32_t action, json_object *json)
{