summaryrefslogtreecommitdiff
path: root/lib/zclient.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2024-06-08 07:15:47 +0200
committerCarmine Scarpitta <cscarpit@cisco.com>2024-06-17 17:09:45 +0200
commit36a310cc9f6ef7694d30fe3527a9462bb7155fd3 (patch)
treea9813807791799990611cb8240ac1e506e097617 /lib/zclient.c
parent209223dae298ed33388563f2947923c0471b2ce7 (diff)
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 <philippe.guibert@6wind.com> Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
Diffstat (limited to 'lib/zclient.c')
-rw-r--r--lib/zclient.c18
1 files changed, 17 insertions, 1 deletions
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: