summaryrefslogtreecommitdiff
path: root/zebra/zapi_msg.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 /zebra/zapi_msg.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 'zebra/zapi_msg.c')
-rw-r--r--zebra/zapi_msg.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c
index f7c123231e..c6210d14ac 100644
--- a/zebra/zapi_msg.c
+++ b/zebra/zapi_msg.c
@@ -2522,6 +2522,22 @@ int zsend_sr_policy_notify_status(uint32_t color, struct ipaddr *endpoint,
return zserv_send_message(client, s);
}
+/* Send client close notify to client */
+int zsend_client_close_notify(struct zserv *client, struct zserv *closed_client)
+{
+ struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ);
+
+ zclient_create_header(s, ZEBRA_CLIENT_CLOSE_NOTIFY, VRF_DEFAULT);
+
+ stream_putc(s, closed_client->proto);
+ stream_putw(s, closed_client->instance);
+ stream_putl(s, closed_client->session_id);
+
+ stream_putw_at(s, 0, stream_get_endp(s));
+
+ return zserv_send_message(client, s);
+}
+
/* Send response to a table manager connect request to client */
static void zread_table_manager_connect(struct zserv *client,
struct stream *msg, vrf_id_t vrf_id)