summaryrefslogtreecommitdiff
path: root/lib/zclient.c
diff options
context:
space:
mode:
authorKaren Schoener <karen@voltanet.io>2020-12-07 18:01:01 -0500
committerKaren Schoener <karen@volta.io>2020-12-07 18:22:36 -0500
commit581e797e02d91cb1c5a7acfd9b2f8c8feb1cde56 (patch)
treed1ec08584f36686aa19986093d1d06b91687f102 /lib/zclient.c
parent6a684109aea0e8b314340a00d9c353df0b3daab4 (diff)
zebra: Adding zapi client close notification
When zebra detects a client close, send a zapi client close notification. Signed-off-by: Karen Schoener <karen@voltanet.io>
Diffstat (limited to 'lib/zclient.c')
-rw-r--r--lib/zclient.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/zclient.c b/lib/zclient.c
index 053014f86d..ba94b7fb99 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -3528,6 +3528,23 @@ stream_failure:
return -1;
}
+/* Utility to decode client close notify info */
+int zapi_client_close_notify_decode(struct stream *s,
+ struct zapi_client_close_info *info)
+{
+ memset(info, 0, sizeof(*info));
+
+ STREAM_GETC(s, info->proto);
+ STREAM_GETW(s, info->instance);
+ STREAM_GETL(s, info->session_id);
+
+ return 0;
+
+stream_failure:
+
+ return -1;
+}
+
/* Zebra client message read function. */
static int zclient_read(struct thread *thread)
{
@@ -3868,6 +3885,12 @@ static int zclient_read(struct thread *thread)
if (zclient->sr_policy_notify_status)
(*zclient->sr_policy_notify_status)(command, zclient,
length, vrf_id);
+ break;
+ case ZEBRA_CLIENT_CLOSE_NOTIFY:
+ if (zclient->zebra_client_close_notify)
+ (*zclient->zebra_client_close_notify)(command, zclient,
+ length, vrf_id);
+ break;
default:
break;
}