From ded79d7013f00a61b19e029a5104b453f696253a Mon Sep 17 00:00:00 2001 From: Carmine Scarpitta Date: Sat, 23 Mar 2024 15:49:43 +0100 Subject: lib: Add ZAPI operation get SRv6 locator Add a new ZAPI operation, ZEBRA_SRV6_MANAGER_GET_LOCATOR, which allows a daemon to request information about a specific locator from the SRv6 SID Manager. Signed-off-by: Carmine Scarpitta --- lib/zclient.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'lib/zclient.c') diff --git a/lib/zclient.c b/lib/zclient.c index 1aab7b48ba..90ec024155 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -3268,6 +3268,47 @@ int srv6_manager_release_locator_chunk(struct zclient *zclient, return zclient_send_message(zclient); } +/** + * Function to request a SRv6 locator in an asynchronous way + * + * @param zclient The zclient used to connect to SRv6 Manager (zebra) + * @param locator_name Name of SRv6 locator + * @return 0 on success, -1 otherwise + */ +int srv6_manager_get_locator(struct zclient *zclient, const char *locator_name) +{ + struct stream *s; + size_t len; + + if (!locator_name) + return -1; + + if (zclient->sock < 0) { + flog_err(EC_LIB_ZAPI_SOCKET, "%s: invalid zclient socket", + __func__); + return -1; + } + + if (zclient_debug) + zlog_debug("Getting SRv6 Locator %s", locator_name); + + len = strlen(locator_name); + + /* Send request */ + s = zclient->obuf; + stream_reset(s); + zclient_create_header(s, ZEBRA_SRV6_MANAGER_GET_LOCATOR, VRF_DEFAULT); + + /* Locator name */ + stream_putw(s, len); + stream_put(s, locator_name, len); + + /* Put length at the first point of the stream. */ + stream_putw_at(s, 0, stream_get_endp(s)); + + return zclient_send_message(zclient); +} + /* * Asynchronous label chunk request * -- cgit v1.2.3 From ee1d20879b0cb44abb77954190a55a07e1921435 Mon Sep 17 00:00:00 2001 From: Carmine Scarpitta Date: Sat, 23 Mar 2024 18:31:12 +0100 Subject: lib: Add ZAPI operations to get/release SRv6 SIDs Add two new ZAPI operations: `ZEBRA_SRV6_MANAGER_GET_SRV6_SID` and `ZEBRA_SRV6_MANAGER_RELEASE_SRV6_SID`. These APIs allow a daemon to get and release an SRv6 SID, respectively. Signed-off-by: Carmine Scarpitta --- lib/log.c | 2 ++ lib/zclient.c | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ lib/zclient.h | 13 ++++++++ 3 files changed, 118 insertions(+) (limited to 'lib/zclient.c') diff --git a/lib/log.c b/lib/log.c index 427e72703c..fa8a8734a4 100644 --- a/lib/log.c +++ b/lib/log.c @@ -437,6 +437,8 @@ static const struct zebra_desc_table command_types[] = { DESC_ENTRY(ZEBRA_SRV6_MANAGER_GET_LOCATOR_CHUNK), DESC_ENTRY(ZEBRA_SRV6_MANAGER_RELEASE_LOCATOR_CHUNK), DESC_ENTRY(ZEBRA_SRV6_MANAGER_GET_LOCATOR), + DESC_ENTRY(ZEBRA_SRV6_MANAGER_GET_SRV6_SID), + DESC_ENTRY(ZEBRA_SRV6_MANAGER_RELEASE_SRV6_SID), DESC_ENTRY(ZEBRA_ERROR), DESC_ENTRY(ZEBRA_CLIENT_CAPABILITIES), DESC_ENTRY(ZEBRA_OPAQUE_MESSAGE), diff --git a/lib/zclient.c b/lib/zclient.c index 90ec024155..8308215de9 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -3309,6 +3309,109 @@ int srv6_manager_get_locator(struct zclient *zclient, const char *locator_name) return zclient_send_message(zclient); } +/** + * Function to request an SRv6 SID in an asynchronous way + * + * @param zclient The zclient used to connect to SRv6 manager (zebra) + * @param ctx Context associated with the SRv6 SID + * @param sid_value SRv6 SID value for explicit SID allocation + * @param locator_name Name of the parent locator for dynamic SID allocation + * @param sid_func SID function assigned by the SRv6 Manager + * @result 0 on success, -1 otherwise + */ +int srv6_manager_get_sid(struct zclient *zclient, const struct srv6_sid_ctx *ctx, + struct in6_addr *sid_value, const char *locator_name, + uint32_t *sid_func) +{ + struct stream *s; + uint8_t flags = 0; + size_t len; + char buf[256]; + + if (zclient->sock < 0) { + flog_err(EC_LIB_ZAPI_SOCKET, "%s: invalid zclient socket", + __func__); + return ZCLIENT_SEND_FAILURE; + } + + if (zclient_debug) + zlog_debug("Getting SRv6 SID: %s", + srv6_sid_ctx2str(buf, sizeof(buf), ctx)); + + /* send request */ + s = zclient->obuf; + stream_reset(s); + + zclient_create_header(s, ZEBRA_SRV6_MANAGER_GET_SRV6_SID, VRF_DEFAULT); + + /* Context associated with the SRv6 SID */ + stream_put(s, ctx, sizeof(struct srv6_sid_ctx)); + + /* Flags */ + if (!sid_zero_ipv6(sid_value)) + SET_FLAG(flags, ZAPI_SRV6_MANAGER_SID_FLAG_HAS_SID_VALUE); + if (locator_name) + SET_FLAG(flags, ZAPI_SRV6_MANAGER_SID_FLAG_HAS_LOCATOR); + stream_putc(s, flags); + + /* SRv6 SID value */ + if (CHECK_FLAG(flags, ZAPI_SRV6_MANAGER_SID_FLAG_HAS_SID_VALUE)) + stream_put(s, sid_value, sizeof(struct in6_addr)); + + /* SRv6 locator */ + if (CHECK_FLAG(flags, ZAPI_SRV6_MANAGER_SID_FLAG_HAS_LOCATOR)) { + len = strlen(locator_name); + stream_putw(s, len); + stream_put(s, locator_name, len); + } + + /* Put length at the first point of the stream. */ + stream_putw_at(s, 0, stream_get_endp(s)); + + /* Send the request to SRv6 Manager */ + return zclient_send_message(zclient); +} + +/** + * Function to release an SRv6 SID + * + * @param zclient Zclient used to connect to SRv6 manager (zebra) + * @param ctx Context associated with the SRv6 SID to be removed + * @result 0 on success, -1 otherwise + */ +int srv6_manager_release_sid(struct zclient *zclient, + const struct srv6_sid_ctx *ctx) +{ + struct stream *s; + char buf[256]; + + if (zclient->sock < 0) { + flog_err(EC_LIB_ZAPI_SOCKET, "%s: invalid zclient socket", + __func__); + return -1; + } + + if (zclient_debug) + zlog_debug("Releasing SRv6 SID: %s", + srv6_sid_ctx2str(buf, sizeof(buf), ctx)); + + /* send request */ + s = zclient->obuf; + stream_reset(s); + + zclient_create_header(s, ZEBRA_SRV6_MANAGER_RELEASE_SRV6_SID, + VRF_DEFAULT); + + /* Context associated with the SRv6 SID */ + stream_put(s, ctx, sizeof(struct srv6_sid_ctx)); + + /* Put length at the first point of the stream. */ + stream_putw_at(s, 0, stream_get_endp(s)); + + /* Send the SID release message */ + return zclient_send_message(zclient); +} + /* * Asynchronous label chunk request * diff --git a/lib/zclient.h b/lib/zclient.h index 87617003d8..bb527f0b41 100644 --- a/lib/zclient.h +++ b/lib/zclient.h @@ -210,6 +210,8 @@ typedef enum { ZEBRA_SRV6_MANAGER_GET_LOCATOR_CHUNK, ZEBRA_SRV6_MANAGER_RELEASE_LOCATOR_CHUNK, ZEBRA_SRV6_MANAGER_GET_LOCATOR, + ZEBRA_SRV6_MANAGER_GET_SRV6_SID, + ZEBRA_SRV6_MANAGER_RELEASE_SRV6_SID, ZEBRA_ERROR, ZEBRA_CLIENT_CAPABILITIES, ZEBRA_OPAQUE_MESSAGE, @@ -1071,12 +1073,23 @@ extern int tm_get_table_chunk(struct zclient *zclient, uint32_t chunk_size, uint32_t *start, uint32_t *end); extern int tm_release_table_chunk(struct zclient *zclient, uint32_t start, uint32_t end); + +/* Zebra SRv6 Manager flags */ +#define ZAPI_SRV6_MANAGER_SID_FLAG_HAS_SID_VALUE 0x01 +#define ZAPI_SRV6_MANAGER_SID_FLAG_HAS_LOCATOR 0x02 + extern int srv6_manager_get_locator_chunk(struct zclient *zclient, const char *locator_name); extern int srv6_manager_release_locator_chunk(struct zclient *zclient, const char *locator_name); extern int srv6_manager_get_locator(struct zclient *zclient, const char *locator_name); +extern int srv6_manager_get_sid(struct zclient *zclient, + const struct srv6_sid_ctx *ctx, + struct in6_addr *sid_value, + const char *locator_name, uint32_t *sid_func); +extern int srv6_manager_release_sid(struct zclient *zclient, + const struct srv6_sid_ctx *ctx); extern enum zclient_send_status zebra_send_sr_policy(struct zclient *zclient, int cmd, -- cgit v1.2.3 From 164117f2ec3d85c7ed63bb81413fb0d28651bc84 Mon Sep 17 00:00:00 2001 From: Carmine Scarpitta Date: Mon, 6 May 2024 17:46:44 +0200 Subject: lib: Add missing info to locator encode/decode Include block/node/function/argument lengthi when encoding/decoding an SRv6 locator. Signed-off-by: Carmine Scarpitta --- lib/zclient.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/zclient.c') diff --git a/lib/zclient.c b/lib/zclient.c index 8308215de9..b0e97b0f12 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -1125,6 +1125,10 @@ int zapi_srv6_locator_encode(struct stream *s, const struct srv6_locator *l) stream_put(s, l->name, strlen(l->name)); stream_putw(s, l->prefix.prefixlen); stream_put(s, &l->prefix.prefix, sizeof(l->prefix.prefix)); + stream_putc(s, l->block_bits_length); + stream_putc(s, l->node_bits_length); + stream_putc(s, l->function_bits_length); + stream_putc(s, l->argument_bits_length); stream_putc(s, l->flags); return 0; } @@ -1141,6 +1145,10 @@ int zapi_srv6_locator_decode(struct stream *s, struct srv6_locator *l) STREAM_GETW(s, l->prefix.prefixlen); STREAM_GET(&l->prefix.prefix, s, sizeof(l->prefix.prefix)); l->prefix.family = AF_INET6; + STREAM_GETC(s, l->block_bits_length); + STREAM_GETC(s, l->node_bits_length); + STREAM_GETC(s, l->function_bits_length); + STREAM_GETC(s, l->argument_bits_length); STREAM_GETC(s, l->flags); return 0; -- cgit v1.2.3 From b90cb00974ef84beff603fb0e91a7a38b3a1b6a4 Mon Sep 17 00:00:00 2001 From: Carmine Scarpitta Date: Mon, 6 May 2024 17:53:18 +0200 Subject: lib: Add ZAPI command `ZEBRA_SRV6_SID_NOTIFY` Add a new ZAPI command `ZEBRA_SRV6_SID_NOTIFY` used by zebra to send asynchronous SRv6 SIDs notifications to zclients. Signed-off-by: Carmine Scarpitta --- lib/log.c | 3 ++- lib/zclient.c | 24 ++++++++++++++++++++++++ lib/zclient.h | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-) (limited to 'lib/zclient.c') diff --git a/lib/log.c b/lib/log.c index fa8a8734a4..880180ae5a 100644 --- a/lib/log.c +++ b/lib/log.c @@ -464,7 +464,8 @@ static const struct zebra_desc_table command_types[] = { DESC_ENTRY(ZEBRA_TC_CLASS_DELETE), DESC_ENTRY(ZEBRA_TC_FILTER_ADD), DESC_ENTRY(ZEBRA_TC_FILTER_DELETE), - DESC_ENTRY(ZEBRA_OPAQUE_NOTIFY) + DESC_ENTRY(ZEBRA_OPAQUE_NOTIFY), + DESC_ENTRY(ZEBRA_SRV6_SID_NOTIFY) }; #undef DESC_ENTRY diff --git a/lib/zclient.c b/lib/zclient.c index b0e97b0f12..e4d02d743a 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -2133,6 +2133,30 @@ stream_failure: return false; } +bool zapi_srv6_sid_notify_decode(struct stream *s, struct srv6_sid_ctx *ctx, + struct in6_addr *sid_value, uint32_t *func, + uint32_t *wide_func, + enum zapi_srv6_sid_notify *note) +{ + uint32_t f, wf; + + STREAM_GET(note, s, sizeof(*note)); + STREAM_GET(ctx, s, sizeof(struct srv6_sid_ctx)); + STREAM_GET(sid_value, s, sizeof(struct in6_addr)); + STREAM_GETL(s, f); + STREAM_GETL(s, wf); + + if (func) + *func = f; + if (wide_func) + *wide_func = wf; + + return true; + +stream_failure: + return false; +} + struct nexthop *nexthop_from_zapi_nexthop(const struct zapi_nexthop *znh) { struct nexthop *n = nexthop_new(); diff --git a/lib/zclient.h b/lib/zclient.h index bb527f0b41..bfe955b7ac 100644 --- a/lib/zclient.h +++ b/lib/zclient.h @@ -238,6 +238,7 @@ typedef enum { ZEBRA_TC_FILTER_ADD, ZEBRA_TC_FILTER_DELETE, ZEBRA_OPAQUE_NOTIFY, + ZEBRA_SRV6_SID_NOTIFY, } zebra_message_types_t; /* Zebra message types. Please update the corresponding * command_types array with any changes! @@ -764,6 +765,13 @@ enum zapi_iptable_notify_owner { ZAPI_IPTABLE_FAIL_REMOVE, }; +enum zapi_srv6_sid_notify { + ZAPI_SRV6_SID_FAIL_ALLOC = 0, + ZAPI_SRV6_SID_ALLOCATED, + ZAPI_SRV6_SID_RELEASED, + ZAPI_SRV6_SID_FAIL_RELEASE, +}; + enum zclient_send_status { ZCLIENT_SEND_FAILURE = -1, ZCLIENT_SEND_SUCCESS = 0, @@ -816,6 +824,28 @@ zapi_rule_notify_owner2str(enum zapi_rule_notify_owner note) return ret; } +static inline const char *zapi_srv6_sid_notify2str(enum zapi_srv6_sid_notify note) +{ + const char *ret = "UNKNOWN"; + + switch (note) { + case ZAPI_SRV6_SID_FAIL_ALLOC: + ret = "ZAPI_SRV6_SID_FAIL_ALLOC"; + break; + case ZAPI_SRV6_SID_ALLOCATED: + ret = "ZAPI_SRV6_SID_ALLOCATED"; + break; + case ZAPI_SRV6_SID_FAIL_RELEASE: + ret = "ZAPI_SRV6_SID_FAIL_RELEASE"; + break; + case ZAPI_SRV6_SID_RELEASED: + ret = "ZAPI_SRV6_SID_RELEASED"; + break; + } + + return ret; +} + /* Zebra MAC types */ #define ZEBRA_MACIP_TYPE_STICKY 0x01 /* Sticky MAC*/ #define ZEBRA_MACIP_TYPE_GW 0x02 /* gateway (SVI) mac*/ @@ -1144,6 +1174,10 @@ bool zapi_rule_notify_decode(struct stream *s, uint32_t *seqno, bool zapi_ipset_notify_decode(struct stream *s, uint32_t *unique, enum zapi_ipset_notify_owner *note); +bool zapi_srv6_sid_notify_decode(struct stream *s, struct srv6_sid_ctx *ctx, + struct in6_addr *sid_value, uint32_t *func, + uint32_t *wide_func, + enum zapi_srv6_sid_notify *note); /* Nexthop-group message apis */ extern enum zclient_send_status -- cgit v1.2.3 From 4dcb69e0f91c8698be537a3e46b075b703afe8b3 Mon Sep 17 00:00:00 2001 From: Carmine Scarpitta Date: Fri, 3 May 2024 19:31:56 +0200 Subject: zebra: Fix checkpatch warning Signed-off-by: Carmine Scarpitta --- lib/zclient.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/zclient.c') diff --git a/lib/zclient.c b/lib/zclient.c index e4d02d743a..a1386e501a 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -3447,7 +3447,7 @@ int srv6_manager_release_sid(struct zclient *zclient, /* * Asynchronous label chunk request * - * @param zclient Zclient used to connect to label manager (zebra) + * @param zclient The zclient used to connect to label manager (zebra) * @param keep Avoid garbage collection * @param chunk_size Amount of labels requested * @param base Base for the label chunk. if MPLS_LABEL_BASE_ANY we do not care -- cgit v1.2.3 From 36a310cc9f6ef7694d30fe3527a9462bb7155fd3 Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Sat, 8 Jun 2024 07:15:47 +0200 Subject: zebra, lib: add locator name in sid notify messages In the near future, some daemons may only register SIDs. This may be the case for the pathd daemon when creating SRv6 binding SIDs. When a locator is getting deleted at ZEBRA level, the daemon may have an easy way to find out the SIds to unregister to. This commit proposes to add the locator name to the SID_SRV6_NOTIFY message whenever possible. Only case when an allocation failure happens, the locator will not be present. In all other places, the notify API at procol levels has the locator name extra-parameter. Signed-off-by: Philippe Guibert Signed-off-by: Carmine Scarpitta --- lib/zclient.c | 18 +++++++++++++++++- lib/zclient.h | 3 ++- zebra/zapi_msg.c | 11 ++++++++++- zebra/zapi_msg.h | 2 +- zebra/zebra_srv6.c | 15 ++++++++++++--- 5 files changed, 42 insertions(+), 7 deletions(-) (limited to 'lib/zclient.c') diff --git a/lib/zclient.c b/lib/zclient.c index a1386e501a..586ee9c2cb 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -2136,9 +2136,12 @@ stream_failure: bool zapi_srv6_sid_notify_decode(struct stream *s, struct srv6_sid_ctx *ctx, struct in6_addr *sid_value, uint32_t *func, uint32_t *wide_func, - enum zapi_srv6_sid_notify *note) + enum zapi_srv6_sid_notify *note, + char **p_locator_name) { uint32_t f, wf; + uint16_t len; + static char locator_name[SRV6_LOCNAME_SIZE] = {}; STREAM_GET(note, s, sizeof(*note)); STREAM_GET(ctx, s, sizeof(struct srv6_sid_ctx)); @@ -2151,6 +2154,19 @@ bool zapi_srv6_sid_notify_decode(struct stream *s, struct srv6_sid_ctx *ctx, if (wide_func) *wide_func = wf; + STREAM_GETW(s, len); + if (len > SRV6_LOCNAME_SIZE) { + *p_locator_name = NULL; + return false; + } + if (p_locator_name) { + if (len == 0) + *p_locator_name = NULL; + else { + STREAM_GET(locator_name, s, len); + *p_locator_name = locator_name; + } + } return true; stream_failure: diff --git a/lib/zclient.h b/lib/zclient.h index bfe955b7ac..2877b347d8 100644 --- a/lib/zclient.h +++ b/lib/zclient.h @@ -1177,7 +1177,8 @@ bool zapi_ipset_notify_decode(struct stream *s, bool zapi_srv6_sid_notify_decode(struct stream *s, struct srv6_sid_ctx *ctx, struct in6_addr *sid_value, uint32_t *func, uint32_t *wide_func, - enum zapi_srv6_sid_notify *note); + enum zapi_srv6_sid_notify *note, + char **locator_name); /* Nexthop-group message apis */ extern enum zclient_send_status diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index 164c0dd687..2a1eea9594 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -1001,7 +1001,9 @@ void zsend_neighbor_notify(int cmd, struct interface *ifp, void zsend_srv6_sid_notify(struct zserv *client, const struct srv6_sid_ctx *ctx, struct in6_addr *sid_value, uint32_t func, - uint32_t wide_func, enum zapi_srv6_sid_notify note) + uint32_t wide_func, const char *locator_name, + enum zapi_srv6_sid_notify note) + { struct stream *s; uint16_t cmd = ZEBRA_SRV6_SID_NOTIFY; @@ -1027,6 +1029,13 @@ void zsend_srv6_sid_notify(struct zserv *client, const struct srv6_sid_ctx *ctx, stream_putl(s, func); /* SRv6 wide SID function */ stream_putl(s, wide_func); + /* SRv6 locator name optional */ + if (locator_name) { + stream_putw(s, strlen(locator_name)); + stream_put(s, locator_name, strlen(locator_name)); + } else + stream_putw(s, 0); + stream_putw_at(s, 0, stream_get_endp(s)); zserv_send_message(client, s); diff --git a/zebra/zapi_msg.h b/zebra/zapi_msg.h index 3505bc0dc4..9e3ea6fb6e 100644 --- a/zebra/zapi_msg.h +++ b/zebra/zapi_msg.h @@ -97,7 +97,7 @@ extern void zsend_neighbor_notify(int cmd, struct interface *ifp, extern void zsend_srv6_sid_notify(struct zserv *client, const struct srv6_sid_ctx *ctx, struct in6_addr *sid_value, uint32_t func, - uint32_t wide_func, + uint32_t wide_func, const char *locator_name, enum zapi_srv6_sid_notify note); extern int zsend_client_close_notify(struct zserv *client, diff --git a/zebra/zebra_srv6.c b/zebra/zebra_srv6.c index a6db66bbcc..0ca77a4974 100644 --- a/zebra/zebra_srv6.c +++ b/zebra/zebra_srv6.c @@ -2280,7 +2280,7 @@ static int srv6_manager_get_sid_internal(struct zebra_srv6_sid **sid, sid_value ? sid_value : &in6addr_any, locator_name); /* Notify client about SID alloc failure */ - zsend_srv6_sid_notify(client, ctx, sid_value, 0, 0, + zsend_srv6_sid_notify(client, ctx, sid_value, 0, 0, NULL, ZAPI_SRV6_SID_FAIL_ALLOC); } else if (ret == 0) { if (IS_ZEBRA_DEBUG_PACKET) @@ -2294,6 +2294,8 @@ static int srv6_manager_get_sid_internal(struct zebra_srv6_sid **sid, zsend_srv6_sid_notify(client, ctx, &(*sid)->value, (*sid)->func, (*sid)->wide_func, + (*sid)->locator ? (*sid)->locator->name + : NULL, ZAPI_SRV6_SID_ALLOCATED); } else { if (IS_ZEBRA_DEBUG_PACKET) @@ -2308,6 +2310,9 @@ static int srv6_manager_get_sid_internal(struct zebra_srv6_sid **sid, for (ALL_LIST_ELEMENTS_RO((*sid)->client_list, node, c)) zsend_srv6_sid_notify(c, ctx, &(*sid)->value, (*sid)->func, (*sid)->wide_func, + (*sid)->locator + ? (*sid)->locator->name + : NULL, ZAPI_SRV6_SID_ALLOCATED); } @@ -2366,6 +2371,7 @@ static int srv6_manager_release_sid_internal(struct zserv *client, struct zebra_srv6_sid_ctx *zctx; struct listnode *node, *nnode; char buf[256]; + const char *locator_name = NULL; if (IS_ZEBRA_DEBUG_PACKET) zlog_debug("%s: releasing SRv6 SID associated with ctx %s", @@ -2374,6 +2380,9 @@ static int srv6_manager_release_sid_internal(struct zserv *client, /* Lookup Zebra SID context and release it */ for (ALL_LIST_ELEMENTS(srv6->sids, node, nnode, zctx)) if (memcmp(&zctx->ctx, ctx, sizeof(struct srv6_sid_ctx)) == 0) { + if (zctx->sid && zctx->sid->locator) + locator_name = + (const char *)zctx->sid->locator->name; ret = release_srv6_sid(client, zctx); break; } @@ -2383,10 +2392,10 @@ static int srv6_manager_release_sid_internal(struct zserv *client, srv6_sid_ctx2str(buf, sizeof(buf), ctx)); if (ret == 0) - zsend_srv6_sid_notify(client, ctx, NULL, 0, 0, + zsend_srv6_sid_notify(client, ctx, NULL, 0, 0, locator_name, ZAPI_SRV6_SID_RELEASED); else - zsend_srv6_sid_notify(client, ctx, NULL, 0, 0, + zsend_srv6_sid_notify(client, ctx, NULL, 0, 0, locator_name, ZAPI_SRV6_SID_FAIL_RELEASE); return ret; -- cgit v1.2.3