From 55e74ca925f0457bb42be4e26d8ff5d0e314edb6 Mon Sep 17 00:00:00 2001 From: Mark Stapp Date: Thu, 20 Aug 2020 14:13:34 -0400 Subject: [PATCH] zebra: use smaller stream buffer for zapi route notifications The owner-notification zapi message is small; use a small buffer for it. Signed-off-by: Mark Stapp --- lib/zclient.h | 1 + zebra/zapi_msg.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/zclient.h b/lib/zclient.h index 231fdad09b..d9237048bd 100644 --- a/lib/zclient.h +++ b/lib/zclient.h @@ -54,6 +54,7 @@ typedef uint16_t zebra_size_t; /* For input/output buffer to zebra. */ #define ZEBRA_MAX_PACKET_SIZ 16384U +#define ZEBRA_SMALL_PACKET_SIZE 200U /* Zebra header size. */ #define ZEBRA_HEADER_SIZE 10 diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index 1d68019909..f7c123231e 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -764,7 +764,11 @@ static int route_notify_internal(const struct prefix *p, int type, "Notifying Owner: %s about prefix %pFX(%u) %d vrf: %u", zebra_route_string(type), p, table_id, note, vrf_id); - s = stream_new(ZEBRA_MAX_PACKET_SIZ); + /* We're just allocating a small-ish buffer here, since we only + * encode a small amount of data. + */ + s = stream_new(ZEBRA_SMALL_PACKET_SIZE); + stream_reset(s); zclient_create_header(s, ZEBRA_ROUTE_NOTIFY_OWNER, vrf_id); -- 2.39.5