summaryrefslogtreecommitdiff
path: root/lib/zclient.c
diff options
context:
space:
mode:
authorKaren Schoener <karen@volta.io>2020-03-06 10:33:40 -0500
committerKaren Schoener <karen@volta.io>2020-03-23 09:17:17 -0400
commit17da84a49dd665edf50d646d86e52cdf2c4c19b7 (patch)
tree011923776c9c4bf65c50e8296ce51de8434cf9cf /lib/zclient.c
parent5d2724ec2564b648bf93dc7b164a1398cde3c214 (diff)
zebra: Synchronous client queues accumulate messages from zebra.
Zebra is currently sending messages on interface add/delete/update, VRF add/delete, and interface address change - regardless of whether its clients had requested them. This is problematic for lde and isis, which only listens to label chunk messages, and only when it is waiting for one (synchronous client). The effect is the that messages accumulate on the lde synchronous message queue. With this change: - Zebra does not send unsolicited messages to synchronous clients. - Synchronous clients send a ZEBRA_HELLO to zebra. The ZEBRA_HELLO contains a new boolean field: sychronous. - LDP and PIM have been updated to send a ZEBRA_HELLO for their synchronous clients. Signed-off-by: Karen Schoener <karen@voltanet.io>
Diffstat (limited to 'lib/zclient.c')
-rw-r--r--lib/zclient.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/zclient.c b/lib/zclient.c
index ec193035f5..63aa64318d 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -52,7 +52,8 @@ static void zclient_event(enum event, struct zclient *);
static void zebra_interface_if_set_value(struct stream *s,
struct interface *ifp);
-struct zclient_options zclient_options_default = {.receive_notify = false};
+struct zclient_options zclient_options_default = {.receive_notify = false,
+ .synchronous = false};
struct sockaddr_storage zclient_addr;
socklen_t zclient_addr_len;
@@ -76,6 +77,7 @@ struct zclient *zclient_new(struct thread_master *master,
zclient->master = master;
zclient->receive_notify = opt->receive_notify;
+ zclient->synchronous = opt->synchronous;
return zclient;
}
@@ -374,11 +376,11 @@ static int zebra_message_send(struct zclient *zclient, int command,
return zclient_send_message(zclient);
}
-static int zebra_hello_send(struct zclient *zclient)
+int zclient_send_hello(struct zclient *zclient)
{
struct stream *s;
- if (zclient->redist_default) {
+ if (zclient->redist_default || zclient->synchronous) {
s = zclient->obuf;
stream_reset(s);
@@ -390,6 +392,10 @@ static int zebra_hello_send(struct zclient *zclient)
stream_putc(s, 1);
else
stream_putc(s, 0);
+ if (zclient->synchronous)
+ stream_putc(s, 1);
+ else
+ stream_putc(s, 0);
stream_putw_at(s, 0, stream_get_endp(s));
return zclient_send_message(zclient);
@@ -629,7 +635,7 @@ int zclient_start(struct zclient *zclient)
/* Create read thread. */
zclient_event(ZCLIENT_READ, zclient);
- zebra_hello_send(zclient);
+ zclient_send_hello(zclient);
zebra_message_send(zclient, ZEBRA_INTERFACE_ADD, VRF_DEFAULT);