From 312f7b3f8c7382afef6993aa2110326db2327c35 Mon Sep 17 00:00:00 2001 From: Carmine Scarpitta Date: Sat, 8 Feb 2025 22:17:09 +0100 Subject: 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 --- lib/srv6.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/srv6.c') 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) { -- cgit v1.2.3